help ... isset() don't work on posted variables...

From: Date: Mon, 14 Apr 2003 01:54:06 +0000
Subject: help ... isset() don't work on posted variables...
Groups: php.general 
Request: Send a blank email to php-general+get-143702@lists.php.net to get a copy of this message
Hi gang Working on http://metalbunny.net/addguest.php Source is: http://metalbunny.net/addguest.phps The form has a hidden field called 'posted' with the value 'yes'. I use this to determine if the page got a post from the form, or was loaded from another link. To try and determine if the required fields have been filled in, I'm using isset() ... but apparently I'm doing it wrong, 'cause it ain't working. My other post pages just load the variables from the post vars (without testing if they're set), and then test if they're blank. This works fine, but to make the code on this page simpler (because it's gonna be far more complex in the end), I wanna use isset() ... but for the life of me I cannot get it working... In pseudo-code, what I wanna do is: "IF $name IS blank THEN $error IS 1" "IF $message IS blank THEN $error IS 5" "IF $error IS NOT 0 THEN PRINT $errorMessage[] NUMBER $error" As can be seen from source, I use this setup: if (! isset($HTTP_POST_VARS['message'])) { $error = 5; } if (! isset($HTTP_POST_VARS['name'])) { $error = 1; } Further down (line 56), I've got the code to tricker on the error codes. Also put the debug outprint here. // see if we've got an error and print message if ($error != 0) { echo("<span class=\"redbld\">$errorMessages[$error]</span><br><br>"); } // debug outprint block ... to be removed in final version echo('<span class="smltxt">'); echo("Posted: $posted, Error: $error<br>\n"); echo("Name: $name<br>\n"); if (isset($email)) { echo("Email: $email<br>\n"); } if (isset($city) || isset($country)) { echo("City: $city, Country: $country<br>\n"); } echo("Message: $message<br>\n"); if (isset($link)) { echo("Link: $link<br>\n"); } echo('</span>'); // end debug outprint When posting an empty form, it flies through the empty field check, and and the debug outprint just write Posted: yes, with a blank error code, and all other variables apparently empty ... Anyone has any ideas to offer??? Obviously this is just the beginning ... lots more test code and functionality still lacks being programmed... TIA Rene -- Rene Brehmer This message was written on 100% recycled spam. Come see! My brand new site is now online! http://www.metalbunny.net

« previous php.general (#143702) next »