I am on a bit of a time limit. I need to know how to echo "this is for one" if a php cookie has a value of a, or echo "this is for the other" if the value of the cookie is b. I have the cookie working (I think), I just need to figure out how to change the text depending on the $value of the cookie.
Help needed asap
1
I am on a bit of a time limit. I need to know how to echo "this is for one" if a php cookie has a value of a, or echo "this is for the other" if the value of the cookie is b.
I have the cookie working (I think), I just need to figure out how to change the text depending on the $value of the cookie.
Here is the code I have to set the cookie:
Here is what I currently have to get it:
cookie.
I have the cookie working (I think), I just need to figure out how to change the text depending on the $value of the cookie.
Here is the code I have to set the cookie:
Code:
<?php
$value = array("a", "b");
$pickOne = array_rand($value, 1);
$aRandomSelection = $value[$pickOne ];
setcookie("MyCookieName", $aRandomSelection, time
()+3600*24*30); /* expire in 30 days */
?> Code:
<?php
if (isset($_COOKIE["MyCookieName"])) {
echo "Welcome guest! <br>";
}
?> - jbearnolimits
Next Topics on Trending Feed
-
1