Results 1 to 2 of 2

Thread: php redirect header problem.

  1. #1
    Join Date
    Jul 2007
    Location
    Irmo, SC
    Posts
    96
    Thanks
    10
    Thanked 7 Times in 7 Posts

    Default php redirect header problem.

    Ok I have never seen this happen before and its driving me crazy.

    I have a very simple form that has a list of states in it. On submit it sends the id of the form element back to itself. I retrieve the id from the $_POST element. I then send an output header to the results page passing the post variable as a parm.

    Problem with this particular form is it in insists on opening the called page in a new window.......

    Code:
    <form action="mods/class/search.php" method="post" name="search" target="_blank">
                        <select class="TextField" name="state_id" size="1">
                        <option value="">Select A State</option>
                            <?php
                            $ssql = mysql_query("SELECT * FROM ".$prefix."_states where country = 'USA' ORDER BY name");
                            while ($state = mysql_fetch_array($ssql)) {
                                echo "<option value=\"".$state['id']."\"";
                                echo ">".$state['name']."</option>\n";
                            }
                            ?>
                        </select>&nbsp;&nbsp; <input type="submit" value ="Submit" name="submit"  class="Submit">
    
    </form> 
    
    
    
    
    if (isset($_POST['submit'])) {
      $state_id = $_POST['state_id'];
      header("Location: ../../index.php?page=mods/class/results&state_id=".$_POST['state_id']."");
      
    }
    anyone have any ideas why its forcing the page to open in a new window?

  2. #2
    Join Date
    Jul 2007
    Location
    Irmo, SC
    Posts
    96
    Thanks
    10
    Thanked 7 Times in 7 Posts

    Default

    um,,,, nevermind... cant believe I just posted that... the blasted form target is set to blank.... I hate copy and paste

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •