Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easy! cookies

Status
Not open for further replies.

toughGirl

MIS
Mar 26, 2001
68
I have created a simple set up but one little thing is not working!!

go to:
With the login page, a cookie is set (if the box is checked) and it tells you on the next page what your name is. I also have a registration page that is validated with the field names beginning with 'required'. So I made a second page to jump to after registration is completed, but for some reason it won't read this cookie! The code is exactly the same as the other page, but it just wont work here! ugh

tG
--{-{@
 
im sorry, i dont understand... where do I specify the path and where to i put '/'?

thanks tG
--{-{@
 
Edit the last line of code in your setCookie function to the following:

document.cookie = cookieStr+";expires=" + expireDate.toGMTString() + ";path=/"
 
It still doesnt work! i just dont know...

tG
--{-{@
 
Oops, I was looking at the wrong page. In your login_action2 page you have the following code:
if(getCookie("username")){
document.write(getCookie("username"));

But there's no getCookie function on this page...just a getCookie2 function.

Hope that helped...
 
Actually the code that's in the login_action2 page is:
Code:
if(getCookie2("requiredusername")){
	document.write(getCookie("requiredusername"));

I don't know where my head's at today...
 
Thanks for you attention! So is this code correct? The reason i had a second login_action page is because my fields were different. So the problem is that the login_action2 isnt reading the cookie:requiredusername . I tried to add the path/ but that didnt work.

Is there something I should change? tG
--{-{@
 
On the login_action2 page change try changing the code:
if(getCookie2("requiredusername")){
document.write(getCookie("requiredusername"));
}

To:
if(getCookie2("requiredusername")){
document.write(getCookie2("requiredusername"));
}

If this doesn't work let me know and I'll take a look at it again tomorrow when I'm not so tired...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top