I am trying to create a cookie for one of my web pages. I’ve found lots of php code but they all hard code the users name in the php. This is an attendance system on my web page. I want to pre-populate the name field of a form. I can put my name in the php code but that only works for me. Does PHP have an input function or can it grab the value from a form? This is a WP site. Example: Page one asks for the users name. The form then redirects to page 2 using Query String to carry the users name so it can populate the new form. Problem: I don’t know how to move the Users name from the form to the PHP set cookie code. I could just use an input function to get the name, if PHP has one. I am so close, it works with a hard coded name but I can’t make it a variable. Any suggestions are appreciated.
You should be POST’ing the data, not using GET. Nevertheless, as you are doing it the name will be available in the GET variable. i.e $_GET[‘name’]
Sorry I missed your answer. I am posting the cookie and not getting it. My issue is, how can I add an input field so the user can enter their name and that is what will be used for the cookie.
This is for someone that is logged into a wordpress site?
No, They are not logged in. There is a wordpress page where they should be able to enter their name and that then creates a cookie. The next time they come back to the page, it will auto display their name and add their name to another form.