1

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?

4
  • You had already asked a similar question Commented Mar 7, 2015 at 5:02
  • Are you closing your form? Commented Mar 7, 2015 at 5:05
  • why you may try session ? Commented Mar 7, 2015 at 5:06
  • </form> your form needs this. Commented Mar 7, 2015 at 5:08

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.