nimusi Posted January 7, 2010 Share Posted January 7, 2010 I have several pages with textboxes which require an ID number. I want to allow the user to enter an ID into the text box. However, if they do not know the required ID I want them to be able to click on a 'Search' link to go to a search page and select an ID. However, when they have selected the ID they should be returned to the referring page with the selected text box populated with the ID. I am managing to return to the referring page by setting a $_SESSION variable when the search starts, but how do I determine which is the active text box before I call the search page? if (isset($_POST['submitSearch'])) { $_SESSION['ReferPage']) = "postdetails.php"; $_SESSION['SearchWhat'] = $_POST['SearchWhat']; $_SESSION['SearchFor'] = $_POST['SearchFor']; header("location: selectperson.php"); } T Link to comment https://forums.phpfreaks.com/topic/187588-returning-to-calling-page-from-a-search-page/ Share on other sites More sharing options...
Catfish Posted January 7, 2010 Share Posted January 7, 2010 you havent really explained this one well enough to understand whats going on. what do you mean by "how do i determine which is the active text box"? my guess is that you need to get the user to input or set the name of the text box they are ID searching for. this could be done using another session variable and the user could set the value perhaps via a dropdown selection box, <form action="search.php" method="post"> <select type="dropdown" name="nameOfFieldToSearch"> <option value="nameOfFieldToSeach">Name of Field to Search</option> etc. </select></form> or you could create a link to the search page for each text box and the url would be something like: <a href="http://www.blah.com/search.php?searchField=nameOfFieldToSearch">Search nameOfFieldToSearch</a> etc. for each text box. In search.php you would use $_POST['nameOfFieldToSearch'] to find an ID, then pass those two value back to the original page to be loaded as the default value in the text boxes. You could pass the values through a form (GET/POST) or set them as session values. Choice is yours. Link to comment https://forums.phpfreaks.com/topic/187588-returning-to-calling-page-from-a-search-page/#findComment-990549 Share on other sites More sharing options...
nimusi Posted January 7, 2010 Author Share Posted January 7, 2010 Sorry, what I meant was that there can be multiple fields on the current page. The user selects one of these text fields then clicks on the search button. The search page provides a search ID which I want to return to the original text field in the original page. I have been able to return to the original page by using a session variable; I think I may be able to use another session variable to store the id of the original text field. When I return from the search I want to populate the selected text field with the ID. Link to comment https://forums.phpfreaks.com/topic/187588-returning-to-calling-page-from-a-search-page/#findComment-990657 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.