[PHP] register_globals off issues
I'm very new to PHP/mySQL and am working through the PHP and mySQL for Dummies examples. Unfortunately, these were all written with register_globals on and the system I'm using has register_globals off. I'm having trouble converting the examples to use the $_POST() expression. Specifically, the examples use a POST with a form variable to run a query and then unset this variable as such: if (@$form == yes) { unset($form); } 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. Does anyone have any suggestions on how to fix this? I know I'm probably missing a few very obvious things here... but I am a newbie. /Mark -- Mark H. Spohr email: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] register_globals off issues
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/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php