Hi all,
I'm a newbie in php.
I encounter a problem with php form that has only one textfield.
If I click on the submit button, the form works fine. However, when I
press 'enter', the form doesn't work right.
After comparing that form with other forms, I noticed the problem
happens because I only have one textfield and a submit button in the
form.
If I add another textfield, I can hit 'enter' to submit the form;
however, that's not a good solution.
Has anyone encountered this problem before, and what's the best
solution?
Here's pseudocode of my php file:
<?php
if (isset($_POST['submit']))
{
if (isset($_POST['textbox']))
header("Location: otherpage.php"); //redirect to other page
}
?>
//else stay on the form page
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Please enter something in the textbox
<input type="text" name="textbox" size="20">
<input type="submit" value="Submit" name="submit">
</form>
Does anyone have the right solution for this problem?
FYI, I use php 4.3.3 and I test it on IE 6.0.
I really appreciate your help and thx in advance.
Regards,
Tony