Log in

View Full Version : php redirect header problem.



gpigate
12-04-2008, 04:18 PM
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.......


<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?

gpigate
12-04-2008, 04:23 PM
um,,,, nevermind... cant believe I just posted that... the blasted form target is set to blank.... I hate copy and paste :)