Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Dec 2010
    Location
    London
    Posts
    333
    Thanks
    63
    Thanked 11 Times in 11 Posts

    problems with using $_POST['submit']?

    Hi there

    I've remember reading on the signature from a member of this board saying not to use isset($_POST['submit']) because of an IE bug. Instead I've always used hidden inputs with the name being used in the $_POST['namevalue'].

    I'm now trying to create a single form with 2 submit buttons but this only seems to work if I use 2 actual submit buttons to send the POST data (instead of hidden as well)

    After trying to research on the problem with using isset($_POST['submit']) I now can't find any articles saying it's a poor method.

    Is this the case, are they OK to use??
    Last edited by paddyfields; 04-26-2012 at 01:36 PM. Reason: i'm an idiot.

  • #2
    Regular Coder
    Join Date
    Dec 2010
    Location
    London
    Posts
    333
    Thanks
    63
    Thanked 11 Times in 11 Posts
    ah, sorry i just found the thread.

    http://www.codingforums.com/php/240088-ie-if-isset-%24_post%5Bsubmit%5D-bug-explained.html#post1144368

    I suppose it's worth reminding people any.

    Cheers to tangoforce.

  • #3
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,298
    Thanks
    57
    Thanked 525 Times in 512 Posts
    Blog Entries
    5
    Hi

    If you need two submit buttons, then you can use them for processing - the user has to choose between them (unless you have a submit and an edit button - then you may want to still use a hidden for submit but also check for a edit).

    The bug relates to the key press of the return key if the cursor is in a text box. Typically with one submit button on the form the user will just hit return rather than grabbing the mouse and clicking the button however with two buttons they'll often need to decide hence you're guaranteed to get one of them (normally).
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #4
    Regular Coder
    Join Date
    Dec 2010
    Location
    London
    Posts
    333
    Thanks
    63
    Thanked 11 Times in 11 Posts
    Thank you. I took your advice on this for my forms when first reading it a while ago, but now have come to a situation where I need two submit buttons. Thankfully there are no input boxes so the return key problem is not an issue.

    Cheers.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •