Jump to content

POST data lost on enter key but works on mouse click


freephoneid

Recommended Posts

Hi,

    I'm using PHP 5. I've 2 forms in 1 php page & multiple buttons (Edit & Delete) as well. When I click the Edit or Delete button using mouse, it behavous as expected.

 

    However, when I hit the enter key, it does submit the form but the POST data does not contain any of these buttons (delete or edit) info. What I need is I should be able to get the Edit button in POST but I'm not getting EDIT button at all.

 

Eg:

 

<form action=...method="post">

    <input type="submit" name="selectcompany" value="Edit " onclick="return validateEdit();">

    <input type="submit" name="deletecompany" value="Delete" onclick="return validateDelete();">

</form>

 

When the form is submitted, i'm expecting the $_POST['selectcompany'] but strangely, on hitting enter key, POST data does not contain the button at all.

 

Can any one help me?

 

Thanks!

Hi,

  Thanks for your kind reply. however how can it sends data on mouse click & not with enter key?

 

  The same page works fine with Firefox with enter & mouse key BOTH!!

 

  Do you have any other solution?

 

Thanks again!

Hi,

  Thanks again for the reply....

 

    Well, the reason I asked for alternate solution is because I've multiple forms with multiple buttons. The solution which you've given is just the check for POST method.....which might satisfy other forms conditions as well....thts why I'm little afraid of using that solution....

 

    Any other cool suggestion or soln?

Thanks!

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.