Pressing enter does not submit form
September 6th, 2007 Posted in PHPProblem: pressing enter on form just refreshes page/ Pressing enter in textbox refreshes page
All forms submit one of two ways…
- By clicking submit
- By pressing the ‘enter’ key
Sometimes you may find that pressing enter only resubmits the form or appears to just refresh it.
Reason/Solution
This is a kind of bug with html and is caused by the fact that there is only one textbox in the form, either add another text box and it will work or if you only have one field to enter then add a hidden one like so…
<input name=”" type=”t” value=”" style=”display:none”>
Dont worry, it wont affect any dynamic collection of the POST or GET values as it doesnt have a name.