View Full Version : Need help saving HTML form using php to a text file

09-05-2011, 02:21 PM
So I have created an HTML form with check boxes and text fields. I want to know how make it so when the user clicks save the form submits to a php page, which then saves to a text file. I then want it so that when they return from another computer or someone else goes to the form the results that were put in last time are already selected/typed in. I need to know how to setup the text file and how to setup the php. Also info on if I should apply [CODE]class="1" id="1" name="1"[ICODE]. Which one should I use. Even if no one can figure out how have the form data there when someone comes back, the saving would be helpful. My email is <html><a href mailto: alex.taffe@gmail.com>alex.taffe@gmail.com</a></html>

09-05-2011, 09:01 PM
Does that mean each person will be able to overwrite (or change) the data in the form?
Or does it have to remember different data for different people?


09-05-2011, 09:24 PM
I want anyone to be able to change it. (i am going to have multiple forms) but it doesn't matter that anyone can change it for what I am doing. I am giving great thanks in advance

09-06-2011, 02:45 AM
Show me the form you already have ... the HTML form that needs to
be re-populated with previous data.

09-06-2011, 03:04 AM
Try this link.

09-06-2011, 04:03 AM
Seeing what you've done ... That's a lot of information.

Since I'm guessing you'll want the ability to make different forms,
I would re-think the whole concept of how the form is created to begin with.
You would not need to hand-code a form page each time you need a different form.

I would create a database for the actual form questions.


PATIENT CARE|Accurately Identifies Chief Complaint (direct observation)|3||
PATIENT CARE|Accurately acquires HPI to characterize pain (direct observation)|2|Must identify location, quality, intensity, duration, radiation, timing, exacerbating/ relieving factors, and associated symptoms.|


Each line is one question that tells you which category it is, the question itself, how many checkboxes to make, and the info (if any).

You build this .txt for for each form you make. You can cut and paste different lines from one form to another.

Then, one PHP script opens the appropriate .txt form file and generates your form.
It breaks apart the categories, numbers the questions, and creates the necessary HTML checkboxes, comment box, etc.
The categories and questions are numbered in the order in which they appear in your form .txt file.
You could even use Google Docs (spreadsheet) to create your form files (online and free).


Now, back to your original idea of saving the form information.

This of course depends on how the form is generated. The PHP generation script
needs to have a scheme for naming your checkboxes and comment boxes.

I'm still so puzzled as to why you wish to redisplay the form with the data for
anyone to overwrite ... I can't figure out why that would happen.

But ... alas ... what you have is too hard for me to script in less than one hour.
I would do it for a fee, but I just don't have the time to script this for free.

This is a big project ... beyond the scope of using this forum.


09-06-2011, 01:02 PM
I realize that the form is huge, but could you write a quick script with like two checkboxes and one text box. And does this go in the .txt file
I am no familiar with MySQL. I hope .txt can be used for this. Like I said, a quick example is all I need, if you could just email me the .html, .txt, and .php to me I could easily replicate it, as I do realize the scale of this project. My email is alex.taffe@gmail.com

09-06-2011, 04:51 PM
Maybe this evening I might be able (USA central time).

09-07-2011, 03:47 PM
I'm stuck on a question again ...

Why are you using checkboxes?
With that, they can check more than one box?

Did you mean to use "radio buttons" instead?
So they can only pick one for each question?