#6298816, By BCrowe PHP anomaly

  • BCrowe 21 Jun 2010 17:08:15 524 posts
    Seen 3 days ago
    Registered 8 years ago
    Techno Hippy wrote:
    BCrowe wrote:
    There's nothing wrong with that code snippet, I just tested it in Opera and it works fine. value="Submit" or value="Reply" makes no difference.

    Using an input type of image instead of submit changes the variables that get posted to PHP when the button is clicked. For a normal input type with name="DoSomething" and value="Go", you'd get $DoSomething in PHP with a value of "Go" (or just $_POST['DoSomething'] if register_globals is turned off). An image submit of the same type gives you $DoSomething_x and $DoSomething_y in PHP, with the x and y coordinates of where on the image was clicked. If your button does not have name attribute, as above, then you'll just get $x and $y. If you're checking for a certain value after the button is clicked, make sure you take that into account.

    Surely that wouldn't stop the form from posting? It would just be a problem when you tried to handle the form data?

    Correct, I wrote that before I read the thread properly, thought there'd be no harm mentioning it just in case anyway.
Log in or register to reply