vendredi 6 mars 2015

how to grab variable from php into a new php file

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?


Aucun commentaire:

Enregistrer un commentaire