Re: register_globals off issues

From: Date: Tue, 12 Nov 2002 20:38:05 +0000
Subject: Re: register_globals off issues
References: 1  Groups: php.general php.lang 
Request: Send a blank email to php-general+get-124061@lists.php.net to get a copy of this message
At 21:05 12.11.2002, Mark Spohr said: --------------------[snip]-------------------- >I'm trying to convert this to use $_POST() as such: > > if (@$_POST['form'] == "yes") >{ >unset($_POST['form']); >} > >However, this does not work. It appears that you can't unset the >$_POST['form'] array element. --------------------[snip]-------------------- unset() works for any variable - also for the superglobals like $_POST. Try this: --------------------[cut here]-------------------- <xmp> <?php print_r($_POST); echo 'F1 = ', $_POST['f1'], "\nF2 = ", $_POST['f2'], "\n"; unset($_POST['f2']); print_r($_POST); ?> </xmp> <form method="POST"> <input type="text" name="f1" value="<?php echo $_POST['f1'];?>"> <br> <input type="text" name="f2" value="<?php echo $_POST['f2'];?>"> <br> <input type="submit"> </form> --------------------[/cut here]-------------------- What error do you get? Make sure you're using the correct case - PHP is case sensitive in variable names and associative index keys... -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/

« previous php.general (#124061) next »