andy182 Posted October 5, 2008 Share Posted October 5, 2008 I want to redirect to a page depending on the entered form data.I already made this script, but redirects to "$_Fname2.example.com" rather than "(the form data).example.com". HTML form <form method="post" action="2.php"> First Name:<input type="text" size="12" maxlength="12" name="Fname">:<br /> <br /> </form> PHP code <?php $Fname = $_POST["Fname"]; header('Refresh: 2; url=$_Fname2.test.com'); echo "you will be redirected in 2 seconds."; ?> Quote Link to comment https://forums.phpfreaks.com/topic/127140-solved-form-redirect/ Share on other sites More sharing options...
pjheliking Posted October 5, 2008 Share Posted October 5, 2008 try this <?php $Fname = $_POST["Fname"]; header("Refresh: 2; url=".$_Fname2.".test.com"); echo "you will be redirected in 2 seconds."; ?> Quote Link to comment https://forums.phpfreaks.com/topic/127140-solved-form-redirect/#findComment-657688 Share on other sites More sharing options...
genericnumber1 Posted October 5, 2008 Share Posted October 5, 2008 you need to use double quotes to replace variables $test = 'value'; echo 'Variable\'s value is: $test' // Variable's value is: $test echo "Variable's value is: $test"; // Variable's value is: value Quote Link to comment https://forums.phpfreaks.com/topic/127140-solved-form-redirect/#findComment-657691 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.