Im just having a play with cookies and im stuck on this. I just want to be able to store a value in a cookie and retreive it at a given time. So I use the statement
Code
code:
This the below code could create a cookie called "username" and set the value to "my name"
Code
code:
this code should retreive the cookie
Code
code:
But for some reason its either not storing the cookie correctly or retreiving the cookie correctly. Have I missed something here? Any help appreciated.
$to_set is a reference to a Perl cookie object. The cookie doesn't actually get sent to the browser until it's output in an HTTP header. The CGI.pm documentation illustrates how to do this.
The cookie has to be fetched by a separate HTTP request, e.g., a separate invocation of a script.
What I basically need to do is. A subroutine is called, when its called I need to get the value of a cookie, if its not blank then 'do this' else 'do that' and set the value ot the cookie to 'blah'.
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.