borden0108 Posted July 8, 2011 Share Posted July 8, 2011 Hi all wondering if you could help me i need to have a html file that has a input box and a php that takes that input and then redirects the user to a site for example the user puts in their id ( for this sake 7574746 in the input box) and then php takes them to the url http://examplesite.com/users/7574746/2011/timetable my html code looks like this <html> <body> <form action="index.php" method="post"> Link: <input type="text" name="id" /> <input type="submit" /> </form> </body> </html> my php code <html> <body> <?php header("Location: http://www." + $_POST["id"] + ".com/"); ?> </body> </html> thanks matt (borden0108) Link to comment https://forums.phpfreaks.com/topic/241389-php-links/ Share on other sites More sharing options...
msaz87 Posted July 8, 2011 Share Posted July 8, 2011 HTML page: <html> <body> <form action="redirect.php" method="post"> Link: <input type="text" name="id" /> <input type="submit" /> </form> </body> </html> PHP page: <?php $user_id = $_REQUEST['id']; header('Location: http://www.example.com/users/'.$user_id.'/'); ?> Your redirect page only needs PHP -- if you have any HTML in it, it has to be below the header redirect, or it'll fail Link to comment https://forums.phpfreaks.com/topic/241389-php-links/#findComment-1239964 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.