Posted by Paul Lautman on 06/13/06 08:21
David Haynes wrote:
> Alex Murphy wrote:
>> But... how to post a predefined variable?
>>
>
> The first step is to get php to send the predefined value to the web
> browser. This may be done using SESSIONs.
>
> session_start();
> $_SESSION['predefined'] = $predefined;
> session_write_close();
> header('Location: first_page.php');
>
> Then, in first_page.php, you get the predefined value back and place
> it into a POST value.
>
> session_start();
> <form action="second_page.php" method="POST">
> <input type="hidden" name="predefined" value="<?php echo
> $_SESSION['predefined'];?>">
> </form>
>
> Now, the value of 'predefined' is available to second_page.php as a
> $_POST value.
>
> $predefined = $_POST['predefined'];
>
> Does this help?
>
> -david-
But if he simply wants to carry a value from one page to the next and he is
doing it via a hidden field in a post, does he really need the session?
[Back to original message]
|