[UPHPU] Posting a form

David Smith DavidSmith at byu.net
Thu Feb 24 09:45:36 MST 2005


>> Finally the question:  How do I make the enter key behave the same as
>> clicking the submit button?
>> All of my users insist they be able to press the enter key instead of
>> clicking on the submit button or tabbing to it and then pressing
>> enter.  I am at a loss.  I am open to just about anything.

<quote who="Wade Preston Shearer">
> That sounds like a fluke or a browser issue. Keying "enter/return" is
> the same as clicking "submit."

Wade's comment is incorrect. The 'submit' $_POST entry will only be set if
the button named 'submit' is actually clicked. This is the designated
behavior for HTTP. What I usually do is use a hidden input field like
this:

  <input type="hidden" name="submit" value="submit" />

Sometimes, I'll name it "action" and set its value to something indicative
of the action to preform, like "create_new_user" or "login", then inspect
the contents of $_POST['action'] in the receiving script.

--Dave



More information about the UPHPU mailing list