-
Cookies and Webform
I have a login area on my site and what I want is when a user returns to display their "username" in the login form.
This is my code but it's not picking up the "username" within the saved cookie. (and yes, the cookie exists!)
PHP Code:
//get username from cookie
function cookie_username() {
$username = $_COOKIE['cookie_name'];
echo "$username";
}
//Then is form
<input type="text" name="username" size="10" maxlength="10" style="font-size: 8pt" value="<?php cookie_username() ?>">
-
Re: Cookies and Webform
could you not use, would save the need for the function.
PHP Code:
<input type="text" name="username" size="10" maxlength="10" style="font-size: 8pt" value="<?=$_COOKIE['cookie_name'] ?>">
-
Re: Cookies and Webform
Does the cookie exist on the client side? - if not then that would indicate a problem with the code which sets the cookie.
-
Re: Cookies and Webform
Yes, the cookie exists. :confused:
-
Re: Cookies and Webform
Could you post the code which sets it?