Click to See Complete Forum and Search --> : GetCookie() not working for me


5sisters
12-29-2002, 01:16 PM
I have some javascript on various pages of my site which writes a cookies - PT_ToDoItemX
Where X is a sequential number

i.e. each time a cookie is written the cookie name has a number added 1, 2, etc...
PT_ToDoItem1
PT_ToDoItem2
etc...

for example (this would be writeen if the link was clicked on 2 different pages)

*PT_ToDoItem1Sepia%20Doveswww.mysite.com/1600389541683229536308325929332829536107*PT_ToDoItem2Another%20Cardwww.mysite.com/160088516723229609533315992332829536107*

The information I want to retrieve from above is -
Sepia Doves and Another Card
I want to have the cookies read & the above information included in a form the user fills in, so I tried the following ...

<form method="post" action="/cgi-bin/mailform.pl">
<input type="hidden" name="recipient" value="customerservice@mysite.com">
<input type="hidden" name="redirect" value="http://www.mysite.com/thanks.htm">
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
document.forms[0].hiddenFieldName.value = GetCookie('PT_ToDoitem');
// End -->
</script>
<input type="hidden" name="hiddenFieldName">
<input type=submit value="Send" name="submit">
<input type=reset value="Clear" name="reset">
</form>

However I keep getting ....
hiddenFieldName: null
... in the resulting email

Which I presume is due somehow to the sequential numbers or the fact that there are more than 1 cookies



Basically I want to have the cookie read & the results included in a form

this is based on
http://javascript.internet.com/cookies/to-do-list.html

Please, can someone help me work out how to do this !!!

Charley Maxwell
:) :) :)

AdamBrill
12-29-2002, 05:25 PM
I think I answered this question here:

http://forums.webdeveloper.com/showthread.php?s=&threadid=1542