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:

    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 might

    if (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/

Reply via email to