Jump to content

[SOLVED] enter vs submit


asmith

Recommended Posts

i've got a user register page , where the form and the script are in one ile (i'm using $_SERVER[PhP_SELF])

 

when  i fill the form and i press he enter button on keyboard the page would reload, and nothing would happen, even if i fill the page wrong, no error will be shown ,

but when i press my submit button on page by mouse , everything works fine,

how can i fix the enter button on keyboard ?  or disable it ?  (without JAVA )

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/81302-solved-enter-vs-submit/
Share on other sites

thats because you must be checking for submit button click

 

if (isset($_POST['submit']))

 

to get around this put a hidden field in your form say

 

<input type="hidden" name="submitted" value="submitted">

 

and then check

 

if (isset($_POST['submitted']))

 

hope its helpful

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.