Two forms (form1 and form2 submit to the same controller.php file. The
controller redirects the page depending on the value of hidden value
'page'. I want form data 'username' and 'password' to be available on
both redirected pages (staff.php and customer.php). How do I accomplish
this?
<!--form1.php-->
<form action="controller.php" method="post">
<input type="hidden" name="page" value="staff.php">
<input name="password" type="password">
<input name="username" type="text">
<input type="submit" value="Submit">
</form>
<!--form2.php-->
<form action="controller.php" method="post">
<input type="hidden" name="page" value="customer.php">
<input name="password" type="password">
<input name="username" type="text">
<input type="submit" value="Submit">
</form>
<?php
//controller.php
header("Location: http://" . $_SERVER['HTTP_HOST']
. dirname($_SERVER['PHP_SELF'])
. "/"
. $_POST["page"]);
?>
<?php
//user.php
echo "Staff Name = " . $_POST["username"];
echo "Staff Password = " . $_POST["password"];
?>
<?php
//customer.php
echo "Customer Name = " . $_POST["username"];
echo "Customer Password = " . $_POST["password"];
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php