Re: Re: Form Data Transfer b/w Pages
| From: | Daniel Clark | Date: | Wed, 21 Apr 2004 16:00:42 +0000 |
| Subject: | Re: Re: Form Data Transfer b/w Pages | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184148@lists.php.net to get a copy of this message | ||
I agree. $_GET[] would expose the username and password on the URL.
> For ease of use, i would create a session and handle it that way or you
> could pass it through $_GET[]
> Query string.
> Would recommend $_SESSION though.
> Cheers
>
> "Sobajo" <tunde@sobajo.com> wrote in message
> news:20040421113728.51451.qmail@pb1.pair.com...
>> 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"];
>> ?>
>