Gossamer Forum
Home : General : Perl Programming :

Script Problem

Quote Reply
Script Problem
Please look at this code:

if($In{ILAN} and $In{ILAD})
{ print "Location: /page2.html\n\n"; }
elsif($In{ILAN} or $In{ILAD})
{ print "For ILA, please fill out both boxes\n\n"; }
else
{ print "Location: /page1.html\n\n";
};

(ILAN and ILAD are both form box names)


Now if both ILAN and ILAD are NOT filed out, the script goes correctly to /page1.html
If ILAN and ILAD ARE filed out, the script goes correctly to /page2.html
But if only 1 is filled out I get 500 error instead of the print statement.

What am I doing wrong here? (yep, new to perl)



________________________
Eraser
Insight Eye
http://www.insighteye.com
Quote Reply
Re: Script Problem In reply to
you need to put a content type header this tells the browser that your displaying text now

print "Content-type: text/html\n\n";

you want to put this before the text and not before any Location type output

Quote Reply
Re: Script Problem In reply to
if($In{ILAN} and $In{ILAD})
{ print "Location: /page2.html\n\n"; }
elsif($In{ILAN} or $In{ILAD})
{ print "Content-type: text/html \n\n"; print "For ILA, please fill out both boxes\n\n"; }
else
{ print "Location: /page1.html\n\n";
};


webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: Script Problem In reply to
Eraser
Insight Eye
http://www.insighteye.com


Nice site.

Wil

Quote Reply
Re: Script Problem In reply to
Hi all,

Thanks for the comments and suggestions.

The code is now how I want it with the finished error check code
in place:

if($In{x_ILA_Number} and $In{x_ILA_Valid_From})
{ print "Location: /payment_mem.html\n\n"; }
elsif($In{x_ILA_Number} or $In{x_ILA_Valid_From})
{ print "Content-type: text/html \n\n"; print "<b>Error:</b> For ILA, please fill out <b>both</b> boxes.\n\n"; }
else
{ print "Location: /payment_reg.html\n\n";
};



________________________
Eraser
Insight Eye
http://www.insighteye.com
Quote Reply
Re: Script Problem In reply to
Of course you don't want the ; after the final bracket Smile

Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: Script Problem In reply to
Typo Wink



________________________
Eraser
Insight Eye
http://www.insighteye.com