I am trying to set up a page that will allow a user to enter their name into a text field and click a submit button. When the button is clicked, the name that the user entered is passed into a cookie, and displayed on the page at the same time.
However, I am having issues getting the name (i.e. the value of the cookie) to be passed along to other pages within the site as well.
I am using jquery to code the JS with. I have the first page all set up and it works beautifully, but when I try to use the getter for the cookie on the second page I get nothing. I am using a cookie plugin for jquery that I found here.
Any help on tis would be great.
Is it even possible to retrieve a cookie value that is set on one page from another page on the same site?
Or should this just be done with php?
you might be better off storing the username in a php session.
Yes it is. You should ensure that the path the cookie is set with is at a high-enough common location. Typically '/' is used for a site-wide accessible cookie.
The page that you linked to provides detailed information on how to set a path for a cookie.