Reputation: 663
I have a form
index.html
<form action="action_page.php" method="post">
<select name="race" style="width: 180px;">
<option value="White">White</option>
<option value="Asian">Asian</option> //
</select>
<input type="submit" value="submit" name="submit"></form>
action_page.php
<?php
$varRedirect = "results.php";
$varRace = $_POST["race"];
function redirect($url, $statusCode = 303)
{
header('location: ' .$url, true, $statusCode);
die();
}
redirect($varRedirect);
?>
results.php
<html> ...
I want to display the selection from index.html (white or asian) on the results.php page but it needs to go through action_page.php because I'm going to manipulate the variable later. I receive an error when I try to do that the way I have so far.
The error I receive is "Notice: Undefined variable: varRace" Also how I can i place stops on my action_page.php with chrome dev tools?
Upvotes: 1
Views: 47
Reputation: 532
quickest way is to append to url and pull in to new page using GET
redirect($varRedirect."?varA=".$varA."&varB=".$varB);
the rest looks ok to me. I don't see why you shouldn't be getting race
Upvotes: 1