coupe-r Posted April 26, 2009 Share Posted April 26, 2009 When I search for something from a search drop down box, the URL reads: delprod.php?search= BUT, the correct items are displaying. Now, if I select a different option from the drop down, the first selection I made displays in the URL but the correct items were queried and displayed on screen. Seems like the URL is always 1 behind the selection. Below is the form action code, which will echo perfectly, but for some reason doesnt go directly to the URL. Let me know if you need a different part of the code. action="delticket.php?search=<?php echo $search; ?>" Quote Link to comment https://forums.phpfreaks.com/topic/155743-posting-to-the-url-is-always-1-selection-behind/ Share on other sites More sharing options...
KPH71 Posted April 26, 2009 Share Posted April 26, 2009 It is difficult to tell from just that however I assume that the $search is a posted value from the form meaning that you are posting the data to the last post location. Can you check what $search is defined at and whether or not you have a 'method=' in your form tag. Quote Link to comment https://forums.phpfreaks.com/topic/155743-posting-to-the-url-is-always-1-selection-behind/#findComment-819796 Share on other sites More sharing options...
coupe-r Posted April 27, 2009 Author Share Posted April 27, 2009 if(isset($_POST['go_btn'])) { $search = $_POST['search_box']; <form id="form3" name="form3" method="post" action="delticket.php?search=<?php echo $search; ?>"> The name of the drop down box is search_box. if I echo $search, it shows the correct value. But when I echo it in the URL, its always 1 behind. Quote Link to comment https://forums.phpfreaks.com/topic/155743-posting-to-the-url-is-always-1-selection-behind/#findComment-819957 Share on other sites More sharing options...
mikesta707 Posted April 27, 2009 Share Posted April 27, 2009 well... since you search works, I don't really see the problem. If you don't want users to see the 1 behind problem, you can use post instead of get Quote Link to comment https://forums.phpfreaks.com/topic/155743-posting-to-the-url-is-always-1-selection-behind/#findComment-819995 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.