Re: PHP and FORM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 9 Oct 2004 08:41:38 -0400, php mysql <pmysql@xxxxxxxxx> wrote:
> I'm writing form using PHP and HTML. The form is submited only if user
> clicks on submit button. However, it's not possible to submit form
> when I press "enter".  Is it possible to submit form pressing on
> enter? If so how?

You can submit the form with pressing enter if the field you are
focusing on when you press enter is inside your <form> tags.  The
thing then is that on the parsing side you must actually test for that
field of the $_POST array, like so:

<?php
if(isset($_POST['my_text_field']) || isset($_POST['submit'])){
  // do whatever
}
?>

<form method="post" action="index.php">
<input type="text" name="my_text_field">
<input type="submit" name="sumit" value="Submit">
</form>


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux