Form problem

Discussion in 'Programming' started by Josh-H, Jul 23, 2007.

  1. #1
    In IE When I use enter/return to submit the form, instead of clicking the submit button, the page refreshes as if the php had been executed but it doesnt; the form isn't submitted.
    
    <form method="POST"><b>What do you want to search by?<br></b>
    <input type="radio" name="group1" value="age">Age<br>
    <input type="radio" name="group1" value="fname">First Name<br>
    <input type="radio" name="group1" value="lname">Last Name <br><br>
    <b>What do you want to search for?</b><br><br><input name="find" type="text" class="input">
    <input name="submit" type="submit" value="Search" class="submit">
    </form>
    
    Code (markup):
    Thats the form code. Is there anything wrong with it? Its fine in firefox, for when I press enter or click the button. +REP awarded.
     
    Josh-H, Jul 23, 2007 IP
  2. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #2
    You have not specified any action in <form
     
    it career, Jul 23, 2007 IP
  3. CoolTemplateCoder

    CoolTemplateCoder Banned

    Messages:
    67
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Try this...
     
    CoolTemplateCoder, Jul 23, 2007 IP
  4. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #4
    That's not much better...

    You should have action="this-page.php", action="?" or action="<?php echo $_SERVER['PHP_SELF']; ?>"

    The "?" is a workaround so you don't have to type the filename of the script, all it does is request the page with a "?" at the end.
     
    krt, Jul 23, 2007 IP
  5. Josh-H

    Josh-H Active Member

    Messages:
    406
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #5
    Tried all of the above, none worked. Still doesn't work right when I press enter.
     
    Josh-H, Jul 23, 2007 IP
  6. Wizard

    Wizard Member

    Messages:
    80
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #6
    If you are hitting the enter key and not clicking on the button, is there a chance the focus is not on the button, and hitting the enter key is not causing the button to execute?
     
    Wizard, Jul 27, 2007 IP