the-botman Posted June 9, 2010 Share Posted June 9, 2010 i have this form now the problem is when i click search it searchs fine but if i just click enter it still searchs but does not search with the value of the search button, i am not sure what i am doing wrong when i input say love and i click search it gives me mysite.com/search.php?vq=love&s=published&submit=Search but if i dont click search and i just click enter i get mysite.com/search.php?vq=love&s=published anyways this is my code thanks in advance <form action="search.php" method="GET"> <div class="menu3"> Search Keywords: <br/> <input type="text" name="vq" /><br /> Order by: <select name="s"> <option value="viewCount">User views</option> <option value="ratin">User rating</option> <option value="published" selected="selected">Newest</option> </select> <br/> <input type="submit" name="submit" value="Search"/> </div> </form>] Quote Link to comment Share on other sites More sharing options...
pdkv2 Posted June 9, 2010 Share Posted June 9, 2010 try using method="POST" in the form tag. Quote Link to comment Share on other sites More sharing options...
syed Posted June 9, 2010 Share Posted June 9, 2010 the botman is correct to use GET, this is not an issuse with the form as such, we need to see some code, have you coded it so that it only executes your search when the button is clicked? Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted June 9, 2010 Share Posted June 9, 2010 Assuming that you're using Internet Explorer (IE), this seems like a browser bug. The code works as expected in FireFox. I've had a lot of problems with forms that only have one text input. IE usually doesn't pass any information. Since your form also has the drop-down menu, at least the form data is being passed. If you add another text input to the form, you should see that the form will work just fine. Note that it doesn't seem to matter if the form is using the GET or POST method. There are a few ways that you can get around this problem: [*]add a second text input and hide it with CSS or [*]add a hidden input field and use that to test if the form was submitted Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.