[BNM] Setting cookie name using a variable (PHP)
Bruce Boughton
bruce.boughton at madgex.com
Thu Nov 1 10:02:56 GMT 2007
Single quotes do not do variable replacement; double quotes do:
$var = 'MyValue';
echo '$var'; // Echoes $var
echo "$var"; // Echoes MyValue
echo $var; // Echoes MyValue
Bruce Boughton
Software Developer
http://www.madgex.com/ - We're hiring!
> -----Original Message-----
> From: bnmlist-bounces at brightonnewmedia.org [mailto:bnmlist-
> bounces at brightonnewmedia.org] On Behalf Of Julian Blundell
> Sent: 01 November 2007 09:57
> To: Brighton New Media
> Subject: Re: [BNM] Setting cookie name using a variable (PHP)
>
> setcookie($itemName, $like, $inTwoMonths);
>
> Remove the quotes! :)
>
> Jules
>
> On 01/11/2007, delarge <delargerock at gmail.com> wrote:
> >
> > What oh
> >
> > I have been trying set some cookies using a variable name like so:
> >
> > setcookie('$itemName', $like, $inTwoMonths);
> >
> > But it doesn't work - it actually calls the cookie '$itemName'
> > Tried without the apostrophes as well but no joy
> >
> > Is what I'm trying to do possible?
> > Can I set a dynamically named cookie?
> >
> > --
> > Paul Burgess
> > --
> >
> > BNM Subscribe/Unsubscribe:
> > http://www.brightonnewmedia.org/options/bnmlist
> >
> > List jobs for 10 pounds on Sussex Digital. Use promo code bnm10
> > http://jobs.sussexdigital.com/
> >
> > Join BNM on Linkedin -
> http://www.linkedin.com/e/gis/23805/5841CA3F0360
> >
> > BNM powered by Wessex Networks:
> > http://www.wessexnetworks.com
> >
> --
>
> BNM Subscribe/Unsubscribe:
> http://www.brightonnewmedia.org/options/bnmlist
>
> List jobs for 10 pounds on Sussex Digital. Use promo code bnm10
> http://jobs.sussexdigital.com/
>
> Join BNM on Linkedin -
http://www.linkedin.com/e/gis/23805/5841CA3F0360
>
> BNM powered by Wessex Networks:
> http://www.wessexnetworks.com
More information about the BNMlist
mailing list. Powered by Wessex Networks