Forum Moderators: coopster

Message Too Old, No Replies

PHP Form Script

         

successfirst

7:36 pm on Dec 27, 2005 (gmt 0)

10+ Year Member



Hi, I need a php script written but I'm not sure what type of database I need and how many databases the script will require. I was wondering if anyone knows.

I need a script that does the following:

1. Has a few form fields (Full Name, Address, City... etc) and a few drop boxes.

2. When the form is submitted it writes the data into a xls file.

3. Every time the script is run a unique id (number) should be generated and written into the xls file together with the rest of the data.

4. Verifies that the telephone number matches the state when the form is submitted, otherwise it will return a error message.

5. Every time the form is submitted, it overwrites the existing xls file and combines the data in one file.

6. It saves the ip, date, time, and URL.

Regards,
Brandon

mm1220

8:32 pm on Dec 27, 2005 (gmt 0)

10+ Year Member



I don't think that a database is needed at all but rather careful use of PHP's file handling functions to manipulate the xls file.

successfirst

9:11 pm on Dec 27, 2005 (gmt 0)

10+ Year Member



The only reason I was thinking a database is needed is to store the xls file.

mm1220

12:22 am on Dec 28, 2005 (gmt 0)

10+ Year Member



Just store it like a regular file?

successfirst

12:42 am on Dec 28, 2005 (gmt 0)

10+ Year Member



So you think I could store it like a regular file, and the script can pull the file and update it when the form is filled out?

mm1220

12:26 pm on Dec 28, 2005 (gmt 0)

10+ Year Member



It may be quite messy to edit an xls file in that manner as opposed to editing a regular text file.

The alternative would be to use a database, not to store the xls file but to store the data which you could export to an xls file. I'm not 100% whether or not this is natively possible with MySQL but you can definitely export to HTML or XML quite easily.

successfirst

3:05 pm on Dec 28, 2005 (gmt 0)

10+ Year Member



Ok, thanks a lot!

slade7

10:30 pm on Dec 28, 2005 (gmt 0)

10+ Year Member



If you use mysql - it doesn't natively export AS xls, BUT, you can output whatever you like to html and then use Excel's import web data feature to import it to an excel file.

Once you set up the file, you can just refresh it when you want to load whatever new data might be there.

It's also a quick and dirty way to keep backup copies of your raw data for small tables (less than 65,536 rows or so)