Jump to content

Recommended Posts

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"); 
?>

 


 

Link to comment
https://forums.phpfreaks.com/topic/276615-php-redirect-to-file/
Share on other sites

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

 

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"); 

?>
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.