Vincent Driessen wrote:
Hi Andreas,
I know the submit button it self doesn't carry the data, but I use it to check if the form has been submitted, or that I have to show a new, fresh, empty form.
Dear Vincent:
I had the same problem in my form. It was just a simple form where someone would enter a record number to search for.
The problem is, the enter key submits the form, but unless you actually press the submit button, that submit value isn't sent along. What you have to do is trick the browser into thinking the submit button has been pressed using an invisible field.
Here's what I mean: I would use an if else to determine if the submit button, which I named "ape", was pressed. If it was, it would process the query, otherwise it would return this form:
<form method="post" action="<?php echo $PHP_SELF?>">
Select a record to edit:
<input type="text" name="ednum" size="7" maxlength="7">
<input type="submit" name="ape" value="Edit this record!">
</form>
But if the user hits "enter" instead of clicking on the select button, the value of "ape" will remain null, and the page will think nothing has been selected, and display the form again. It's still sending the value of "ednum", but that's not what the ifelse is testing for, it's looking for the existence of "ape".
So you trick it into thinking the select button has been pressed when the user hits enter by including one little line before the tag for the submit button:
<input type="hidden" name="ape" value="2">
This line gives "ape" a non-null value that the ifelse statement will respond to.
Hope this helps!