Guest Report post Posted August 25, 2016 So I need a script/code that asks a question and then puts it in the url. For example, the user is asked a question like "Which directory would you like to go now?" and lets say they put /index, then in the url it takes them to /index as they previously stated they wanted to go to /index. If this is possible which I know it is, please help me! Share this post Link to post Share on other sites
Scott 221 Report post Posted August 25, 2016 a bumb after 3 hours is useless 1 Association reacted to this Share this post Link to post Share on other sites
IJzzo 1,072 Report post Posted August 25, 2016 You have to use a submit button and take the value from it on the process url. Then you can build the url based on the value and send out a new header with the new url. If you don't like this procedure you have to use java script. But I am not really smart with php. So good luck. xD Share this post Link to post Share on other sites
Hazard 1 Report post Posted August 25, 2016 (edited) <form class="directory" action="" method="post"> <input type="text" name="example" > <input type="submit" name="submit" value="Search" class="button"> </form> <?php $goodinput = array("Which directory would you like to go now?"); if(!empty($_POST['example'])){ if (in_array($_POST['example'],$goodinput)){ //checks if user input is a good input header('Location: http://www.example.com/directory.php'); exit(); } else { header('Location: http://www.example.com/404.php'); exit(); } } Is this what you mean? Edited August 25, 2016 by Hazard Share this post Link to post Share on other sites
Guest Report post Posted August 27, 2016 On 25/08/2016 at 8:47 PM, Hazard said: <form class="directory" action="" method="post"> <input type="text" name="example" > <input type="submit" name="submit" value="Search" class="button"> </form> <?php $goodinput = array("Which directory would you like to go now?"); if(!empty($_POST['example'])){ if (in_array($_POST['example'],$goodinput)){ //checks if user input is a good input header('Location: http://www.example.com/directory.php'); exit(); } else { header('Location: http://www.example.com/404.php'); exit(); } } Is this what you mean? Ah yes, thank you. Share this post Link to post Share on other sites