Erwin Moller wrote:[color=blue]
> Alex Murphy wrote:
>[color=green]
>> The first page have the pre-define variable. How to transfer to next
>> php page?
>> Thanks[/color]
>
> Hi Alex,
>
> You can do so in different ways.
> If you make a link to the next page, you can pass it via the URL:
> http://www.mysite.com/nextpage.php?myvar=23
>
> You can also store the variable in a session.
> Look up SESSION at www.php.net to get started.
> ($_SESSION[] is per-user.)
>
> You can also store the variable somewhere on a database or in a file.
>
> What is the best way completely depends on what you are trying to
> achieve, but you didn't tell us a lot.
>
> Regards,
> Erwin Moller[/color]
Or if doing a post, you can store it in a hidden input field.
David Haynes wrote:[color=blue]
> Alex Murphy wrote:[color=green]
>> But... how to post a predefined variable?
>>[/color]
>
> 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_c lose();
> header('Locatio n: 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="predefine d" 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-[/color]
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?
Comment