简体   繁体   中英

Take Cookie value insert into php string

I'm making a simple page for our home server for keeping track of in game currency.. My problem was when this line $Tlab = number_format($Tlae - $TlSL + $TlSW , 2, '.', '');

is done, it does work and it spits out the

fclose ($fp);
echo ("[Prv Amount is [$Tlae]  ");
echo ("[Win Amount is [$TlSW]  ");
echo ("[Loss is [$TlSL]  ");
echo ("[Total [$Tlab]  ");

Odd thing is.. the TLab will write its sum value to a cookie, however when it is put into the url to insert into the next page, the value is empty

<A HREF="curncy.php?Tlab=<?php echo $_REQUEST["Tlab"]; ?>"> [Next Round]</A><br />

Did I do something wrong, because any other values used will get passed on?? Or as the cookie does store the $Tlab value [when I do an echo in the next page it does show correctly] how do I take that value from the cookie and give it a workable value

Option 1:

On previeous page: setcookie('Tlab', $Tlab);

On next page: $_COOKIE['Tlab'];

Option 2:

On previous page: <A HREF="curncy.php?Tlab=<?php echo $Tlab; ?>">

On next page: $_REQUEST["Tlab"]; or $_GET["Tlab"];

You should read more on cookies and http requests

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM