frank_solo Posted April 6, 2013 Share Posted April 6, 2013 I want to use a form in whichyou select a location and the type of information you would like to view. It takes you to a subdomain like blah.mysite.com/option1.php option1.php being the the type of information the person selected. This is what I have: <form method="post" action="jump.php"> <table width="100%" border="0"> <tr> <td colspan="3"><div align="center"><span class="whatareyou">What Are You Looking For?</span></div></td> </tr> <tr> <td width="33%"><div align="center" class="whatareyou"> <input type="radio" name="radio" id="type" value="option1.php"> <label for="type"></label>option 1</div></td> <td width="33%"><div align="center" class="whatareyou"> <input type="radio" name="radio" id="type" value="option2.php"> <label for="type"></label>option 2</div></td> <td width="33%"><div align="center" class="whatareyou"> <input type="radio" name="radio" id="type" value="option3.php"> <label for="type"></label>option 3</div></td> </tr> <tr> <td colspan="3"> </td> </tr> <tr> <td colspan="3"><div align="center" class="whatareyou">Where Are You Looking?</div></td> </tr> <tr> <td colspan="3"><div align="center"> <select name="url" id="url" style="font-size:24px"> <option value="http://blah.mysite.co/" selected>blah</option> <option value="http://blahblah.mysite.co/" selected>blahblah</option> <option value="http://blahblahblah.mysite.co/" selected>blahblahblah</option> </select> <input name="button" type="submit" class="button_login" id="button" value="Search"> <br> </div></td> </tr> </table> </form> This is what I'm having trouble with: <?php session_start(); $url = $_POST["url"]; $type = $_POST["type"]; $parsedUrl = $url.'/'.$type; header("Location: $parsedUrl"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/276615-php-redirect-to-file/ Share on other sites More sharing options...
jcbones Posted April 6, 2013 Share Posted April 6, 2013 Whats the problem? Quote Link to comment https://forums.phpfreaks.com/topic/276615-php-redirect-to-file/#findComment-1423293 Share on other sites More sharing options...
frank_solo Posted April 6, 2013 Author Share Posted April 6, 2013 Basically I want the user to select a location like if they choose the first one <option value="http://blah.mysite.co/" selected>blah</option> and then the type of information they seek so they select <input type="radio" name="radio" id="type" value="option1.php"> I would lke the jump.php file to jump them to http://blah.mysite.co/option1.php that's exactly I would like url to show just like that too.Thanks Quote Link to comment https://forums.phpfreaks.com/topic/276615-php-redirect-to-file/#findComment-1423296 Share on other sites More sharing options...
jcbones Posted April 6, 2013 Share Posted April 6, 2013 I understand what you want it to do, and that is all you have stated. You haven't said what the problem is. So, what does your current code do, because the PHP syntax is correct. Copy/Paste the results of: <?php session_start(); $url = $_POST["url"]; $type = $_POST["type"]; $parsedUrl = $url.'/'.$type; var_dump($parsedUrl); //header("Location: $parsedUrl"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/276615-php-redirect-to-file/#findComment-1423298 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.