Re: why values not remembered by php?
| From: | James Atkinson | Date: | Wed, 23 Aug 2000 00:21:16 +0000 |
| Subject: | Re: why values not remembered by php? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13047@lists.php.net to get a copy of this message | ||
On Tue, 22 Aug 2000, Sonia Tsui wrote:
> Here is the sample code
> (main.php)
>
> <?php
> $start = $end;
> $end = $start + 3;
> ?>
>
> <html>
> ......
> <a href ="main.php" ....>nextbutton</a>
> <?php
> for ($i = $start; $i<$end; $i++) {
> echo("i: $i<br>");
> }
> ?>
> </html>
>
> -------------------------------------------------------------------------
> so when <next button> is pressed, it comes back to this page. What I don't
> understand is why $end is not remembered? I though variable exist for one
> http transaction. I expect to see 0, 1, 2, 3 and then 4, 5, 6 etc. but I
> just see 0,1,2,3 and then 0,1,2,3 again and again. Can anyone help with my
> simple question?
>
> ---Sonia
No, your variables won't be remembered after you reload the page. Send your
variables via the URL line. ie: http://myserver.org/main.php?start=4&end=10
It might work if you make the vars static...but I'm not sure...
--
James Atkinson
-----------------------------------------------------------------
James Atkinson 100world
Technical Developer 512-1529 West 6th Avenue
phone: +1-604-266-4490 ext.149 Vancouver, BC, V6J 1R1
fax: +1-604-742-1770 Canada
email: james.atkinson@100world.com http://www.100world.com
+---------------------------------------------------------------+
| This message may contain confidential and/or privileged |
| information. If you are not the addressee or authorized to |
| receive this for the addressee, you must not use, copy, |
| discolse or take any action based on this message or any |
| information herein. If you have received this message in |
| error, please advise the sender immediately by reply e-mail |
| and delete this message. Thank you for you cooperation |
+---------------------------------------------------------------+