POST data lost on enter key but works on mouse click

Discussion in 'PHP' started by freephoneid, Sep 16, 2008.

  1. #1
    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!
     
    freephoneid, Sep 16, 2008 IP
  2. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #2
    How many fields do you have in the form?
     
    mwasif, Sep 17, 2008 IP