Re: Other Notice problem...
| From: | R B | Date: | Fri, 08 Nov 2002 16:27:52 +0000 |
| Subject: | Re: Other Notice problem... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-123410@lists.php.net to get a copy of this message | ||
The array_key_exists or isset is a good solution.
About your comment, i have the register_globals=on.
I have 2 questions:
1.- What's the relation to have register_globals=off with this notice message?
2.- I read the security comment about register_globals=on in the php.ini, but i set to on because if i set to off, i can't pass GET variables to other page. how can you pass GET variables to other page without setting register_globals=on?
From: Ernest E Vogelsinger <ernest@vogelsinger.at> To: "R B" <rbphp@hotmail.com> CC: marcot@tabini.ca,php-general@lists.php.net Subject: Re: [PHP] Other Notice problem... Date: Fri, 08 Nov 2002 17:14:30 +0100 At 17:04 08.11.2002, R B spoke out and said: --------------------[snip]-------------------- I'm going to explain how my script work. I have an php page (addProduct.php) with an input form. I have 2 buttons (add and cancel) and a hidden control with name=status. If i press the add button, the page submit the form data to the same page (<form action="addProduct.php">) with status hidden control name set to ADD, so the if statement its true only if i press the add button. I see the message when i call the page to add the data not when i submit the data. --------------------[snip]-------------------- Ahhh.... your $status variable should be a form variable? Well, as pointed out many times the last days, register_globals is OFF by default since PHP v.4.something. Either turn register_globals on in your PHP.ini (bad and deprecated, read the security bulletins), or you refer to the _POST array:_________________________________________________________________ MSN. Más Útil Cada Día http://www.msn.es/intmap/if ($_POST['status'] == "ADD")if the data is not set (the status control empty), you'll still get a notice about an undefined array index, so you mightif (array_key_exists('status', $_POST)) { switch ($_POST['status']) { case 'ADD': break; default: echo 'Unsupported status!'; } } else echo 'No status sent!';-- O Ernest E. Vogelsinger (\) ICQ #13394035^ http://www.vogelsinger.at/