[thelist] PHP help required please
Jason Lustig
lustig at acsu.buffalo.edu
Sun Feb 3 11:49:01 CST 2002
>By putting it right at the start, it sets the cookie fine, but how do I add
>the value of $username (from the form on the log in page) to the cookie,
>because if I am defining the cookie at the start, $username has no value!
>Sorry if I'm missing something obvious here...
Have the form send the username to the page like this:
<?php
if (isset($username))
{
// set cookie and tell user
} else {
// print form
// the form returns to this page
// so that the cookie will be set
}
?>
And you don't need to put the setcookie() right at the START, just before
you echo() anything or have any HTML.
--jason
More information about the thelist
mailing list