Re: static variables
| From: | Hugh Danaher | Date: | Fri, 10 Feb 2006 06:45:27 +0000 |
| Subject: | Re: static variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-230187@lists.php.net to get a copy of this message | ||
Suresh,
You could use the link to pass your variable to the next page, or to the same page:
Instead of
$count=0;
use
if (!isset($_GET['count'])) $count=0;
Then for your link use
print "<a href=http://www.whatever.com?count=$count>link to new page</a>"
or use
print "<a href=".$_SERVER['PHP_SELF']."?count=$count>link to same page</a>"
if you want to return to the same page with an updated count.
HTH
HTD
----- Original Message ----- From: "suresh kumar" <asureshkumar_1983@yahoo.co.in>
To: <php-general@lists.php.net>
Sent: Thursday, February 09, 2006 9:50 PM
Subject: [PHP] static variables
hai everbody-- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 267.15.4/255 - Release Date: 2/9/2006i am facing a problem with staticvariable. i declared $count=0 as Static variable,when i click the link specified in anchor tag my page is refreshed again and static variable lose its value and assigned with 0.i want the logic code say my stsic variable will not lose scope when i click next,i am looking forward reply from u.A.suresh__________________________________________________________ Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.shaadi.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 267.15.4/255 - Release Date: 2/9/2006