December 10, 201015 yr Below is a sample of a very simple form with one drop down menu. The form posts back to itself, with some php to process the user entry. When the user select "2", I want the variable "test" to be set. But when the user selects "1" I do not want the variable to be set. This works fine when I test it on my local host, but when I upload it to my production server, the variable is always set. If the user selects "1", $test is set to "1" despite the fact that my "if" statement include &&($_POST['test']!="1")!!! Any ideas?? <body> <?php if (isset ($_POST['test'])&&($_POST['test']!="1")) { $test=$_POST['test']; } echo $test ?> <form method="post" action="testing.php"> <select name="test"> <option value="1">1</option> <option value="2">2</option> </select> <input name="submit" type="submit" value="GO!" /> </form> </body>
December 10, 201015 yr Author Also, I tried adding else { die() } after the if statement, but this caused the rest of the page to die. Not sure why????
December 10, 201015 yr Looks like your production server has 'register_globals' enabled. Do you have control over your production server? If so, change the register_globals line in php.ini to Off. Failing that, create a .htaccess file in the root folder of your web space and use the following: php_flag register_globals off
December 10, 201015 yr Author Looks like your production server has 'register_globals' enabled. Do you have control over your production server? If so, change the register_globals line in php.ini to Off. Failing that, create a .htaccess file in the root folder of your web space and use the following: php_flag register_globals off I'll look into that. But what about that die() problem. When I add it to the php, the rest of the page seems to die as well, even all of the html outside of the php block
December 10, 201015 yr Author I went in and set register globals to off and it solved the problem! Thank you so much!
Create an account or sign in to comment