Website Form


I’m looking to add a form to my website. I have the form built in dreamweaver, but I don’t know how to get the form results to be sent to a database. There are about 5 or 6 form question, all with text results. I would like the results to be sent to a database in a comma separated value, what would be the easiest way to set this up?
Thanks for your help :slight_smile:


There is a nice tutorial at which although designed for NetObjects Fusion may give you some ideas. It is a nice introduction to using PHP and MySQL and fairly simple so that you can adapt it to your needs.
I suppose each form item could be saved to a MySQL table field by field and then read out in CSV form using a couple of PHP lines.

You may want to Google for this as it must have been done many times before and you would probably get a more in depth answer.


Opinions are my own views and are not the views of DreamHost.
Any advice offered by me should be acted upon only at your own risk.


Ive found a bunch of stuff on google, but there seems to be a lot of differnet ways to do it, which leaves me even more confused. I figured someone would know a way to do it that would be fairly easy, and definitely work on dreamhost.


Whichever is easiest really. It makes no difference. :slight_smile:


Yeah but if I get thousands of people filling out this form does that mean I will have thousands of separate emails with the form results in each? I’m still not quite sure what formmail can do


I’ve been messing around with formmail a little bit, seems easy to use. I’m just worried about being able to compile all the results from email to my own database. Are there any complete walkthroughs to setting up formmail?


I made the form and everything, but i keep getting this when I try to submit
Method Not Allowed
The requested method POST is not allowed for the URL /sign.html.

I pasted the code of my form below, not sure if there is anything obviously wrong with it? I took out the information about the domain, as Im trying to keep it quiet for now. any help would be great :slight_smile:

First name
Last name
Email Address
Confirm Email Address
Optional Information
Zip Code


It may be something in the rest of the HTML. I just ran the form, without the redirect and adding my email address and that worked okay.

This is what formmail posted back.

Below is the result of your feedback form. It was submitted by
( on Sunday, June 04, 2006 at 13:19:16

firstname: Test
lastname: Form
zip: 1234567


Opinions are my own views and are not the views of DreamHost.
Any advice offered by me should be acted upon only at your own risk.


Crap you’re right! Thanks, I should be able to figure it all out now :slight_smile: Thanks for all your help


I got it to work, and opened my site. I’ve already got about 400 people using my form, which all goes to outlook. Does anyone know of any ways to be able to sort the incoming responses with outlook? Or some other email program? Thats basically the only thing that is making me still want to try a form that would put this all in a database for me.


Why not have your web form post the data straight to a database? Then you could have a (passworded) page where you could view the responses by displaying the database. You could then have the responses sorted how you wanted them.


Opinions are my own views and are not the views of DreamHost.
Any advice offered by me should be acted upon only at your own risk.


Thats the part I don’t really understand how to do too well. How do you configure the form to send it to a database? Whats the easiest way to create the database? I haven’t been able to find any tutorials online telling me how.


There are quite a few sites with examples which might be of use. The problem is that you are never going to find one which matches your needs, so you have to mix and match and adapt the scripts to your own purposes.

Creating the database part is easy. You can do that from the DreamHost ControlPanel under Goodies|Manage Mysql where you can create your database. You basically will have four bits of information The database name, the hostname (e.g. or if you wish) the username (just for use with the database and not to be confused with an email username, although again it can be if you wish.)and lastly a password.

If you think of your program as being in three actions (which can be three PHP programs or one big whoppa PHP program). The actions being, the form, the database connection and the database options (Inputting, Selecting and so forth).

Once you get your head around that, it starts to look a bit better and you no longer wish John Wayne and his troop of cavalry would hurry up and arrive to help you out. :slight_smile:

With that lot in mind search Google for ‘create form send database’ and you will see quite a few options. Have a look at in particular. Do not panic at the mass of words just read through it and you will see there are some examples to try out.

Whatever the result there is no getting away from the fact that you will have to do some studying. So take the week-end off and read a few pages. :slight_smile:


Opinions are my own views and are not the views of DreamHost.
Any advice offered by me should be acted upon only at your own risk.


I think I actually figured it out. Heres my PHP code that my form posts to, the only thing i am not sure how to do is make the form to go to a thanks page or an imcomplete page if they missed a field.

<?php @extract($_POST); if(is_writable('emails.csv')) { $fp = fopen('emails.csv','a'); $content = "$firstname,$lastname,$email,$zip,$conf\n"; fwrite($fp,$content); fclose($fp); } else { echo'File is not writable'; } ?>