I have a MySQL - Apache - PHP setup. I have a web page with a form asking for various input. I want to introduce php into my web page that will take information supplied by the user, send it to a database and store it so that the next time the user logs into the page, all his previous input is still there. Of course the web page will be secured for a single user. Can anyone point me in the right direction as far as what general areas of PHP and database development I need to look into in order to accomplish this. Thanks for any replies.
This is so simple with persistent cookie. Let me explain. Suppose you want to save firstname and lastname for 10 days then write a script setcookie('firstname','john',time()+3600*24*10); setcookie('lastname','de',time()+3600*24*10); Now later when you come back you can access values from $_COOKIE['firstname'] and $_COOKIE['lastname'];
Expanding on the above, you'll want to use some sort of unique hash in the cookie. That way you know which data to pull from the database - depending on which hash is in the cookie.
well, if the user has to log in, you could just run a query like; SELECT * FROM table WHERE userid = $currentuserid LIMIT 0,1 Code (markup): then just echo the values of the row into the input boxes <input type=text" name="whatever" value="<?php echo $row['field']; ?>"> HTML:
The best way to do what you ask and in my opinion the best way to validate forms is to store all the form data into a php Session that way if the user decide to refresh the page in the middle of the process you'd safe and no double input would be inserted into the database.