Reputation: 159
<input id="username" name="username" class="required" type="text">
<input id="email" name="email" class="required" type="text">
I am trying to validate user input on the same page using <form action="<?php $_SERVER['SELF']; ?>"
and then if the input is correct I need to send the input values + 2 additional variables to another php page, let's just call them:
<?php
$var1 = "var1";
$var2 = "var2";
?>
I need a way to pass them over to the next page without using sessions/get/javascript. Is there a way?
Upvotes: 0
Views: 1898
Reputation: 3385
Without sessions/get/javascript I guess your only 2 option might be
header("location:your_next_page?var1=$var1&var2=$var2");
Must be used before any output
Or
Form page:
setcookie("var1", $var1, 0, '/');
setcookie("var2", $var2, 0, '/');
//load next page
Next page:
$var1 = $_COOKIE['var1'];
$var2 = $_COOKIE['var2'];
Upvotes: 2
Reputation: 1441
You can use cookie or localStorage for saving value on browser and retrieve them from another page.
Upvotes: 0