[PHP] Form won't submit when pressing enter key

2003-01-15 Thread Sarah Heffron
I have a form created by this code (I don't know if it's important):

if ($_POST[submit]) {

//do form stuff

} else {
echo html;
echo head;
echo titleForm/title;
echo /head;
echo body;
echo h3Lookup Customer/h3;
echo Enter the customer's uhome/u phone number:br/;
echo form action=\$PHP_SELF\ method=\post\;
echo input type=\text\ name=\phone\ size=\10\ ;
echo input type=\submit\ name=\submit\ value=\Search\;
echo /form;
echo /body;
echo /html;
}



After you fill out the only field, you HAVE to click the submit button to
submit the form. If you press enter to submit the form it reloads the form
and clears out the info that was entered. I can't figure out why this is
happening and I need to make it submit using the enter key and I don't want
to do something fancy with javascript at all.

Please help


Thanks,
Sarah




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Form won't submit when pressing enter key

2003-01-15 Thread Michael Sims
On Wed, 15 Jan 2003 17:23:26 -0800, you wrote:

I have a form created by this code (I don't know if it's important):

if ($_POST[submit]) {
[...]
After you fill out the only field, you HAVE to click the submit button to
submit the form. If you press enter to submit the form it reloads the form
[...]

When you submit a form by pressing enter, the value of the submit
button is not sent in the POST data.  This is not a problem though,
just replace:

if ($_POST[submit]) {

with:

if (!empty($_POST)) {

Which basically says process the form if the $_POST superglobal has
any elements in it whatsoever.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php