Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: If statements while in PRINTby webadept (Pilgrim) |
on Mar 14, 2002 at 03:02 UTC ( [id://151588]=note: print w/replies, xml ) | Need Help?? |
This might be off base, but it looks like your script is working through a browser input/ form data. If this is so, then the key won't show up if the user doesn't put in an answer for the field, even if you pass that field to your CGI script. In other words if I have a field named "address" and the user doesn't fill in that field then the field address won't be in the parse string.
This function is pretty well known from the O'Riely CGI book (good book to get if you are going to do a lot of this stuff) Now with that you can write a simple function page like this to see if the variable even exists before using it. Don't give me credit for the code, again its paraphrased from the O'Riely CGI book, but as you can see it takes care of the problem on if you got the information or not. Hope this helps Glenn H.
In Section
Seekers of Perl Wisdom
|
|