View Full Version : Memorize form

09-09-2011, 12:53 AM
So I am creating an HTML form that is being submitted using php and being saved to a text file. What I want to do now is take that data and reinject it into the form, so that it looks the exact same as when someone comes back to the site. In other words, making the form save itself. I want to use php and save data to a text file because I can't figure out mySQL. The form itself is based on HTML and JavaScript. It contains text areas and check boxes. Any help is greatly appreciated. Also I want the form to be the same for everyone who looks at it. Long story why, but yah.

09-09-2011, 02:12 AM
I know you were using checkboxes numbered like 1 2 3 4 5 etc.

But, are you sure you didn't mean to use radio buttons?
With checkboxes, the user can click two of them, three of them, etc.


09-09-2011, 02:17 AM
I'm afraid that if you want your site to remember a users form details you will have to get to grips with mysql.

You could store the data temporarily in a session (which is basically an array called $_SESSION) but many browsers do not save session id data when they are closed. Also using text files is totally unsecure and not even thread safe meaning that two users could alter it at the same time and you'd have corrupt data.

I know MySQL sounds scary but it really is simpler than you realise. It's thread safe and takes care of everything for you in a table similar to a spreadsheet (except more advanced so you can run searches etc).

If you've not been there, tizag.com have excellent tutorials.

09-09-2011, 02:22 AM
I actually want people to be able to select multiple things using check boxes, and if I use MySQL, how would I do so, and how do I create a MySQL file (I am using Mac if it is software

09-09-2011, 02:02 PM
Show us an example of the form, and if you are using checkboxes,
will the checkboxes be numbered, or will each checkbox have a description
next to them ... I'm wondering if you only care about which boxes were
checked, not specifically the word (or value) of it. As you mentioned, you
will redisplay the same form with the checkboxes checked from the last
person that viewed the form. Each viewer can change the checkboxes and
resubmit the form, overwriting the previous viewer's choices?

I'm working off of this ....