How to save a form into a MySQL database

Dreamweaver is a great tool for designing web forms, but what about saving those forms automatically into a MySQL database without having to create each form field into the database and link them? This is usually a task that requires time + coding and the default Dreamweaver tools don't have an easy and visual solution for this.

Fortunately the Dreamweaver default features can be extended through the installation of Dreamweaver extensions and there is an extension named Form to Database that can do all the work of saving a form into a database with basically two clicks.

What would you need for that?

  1. You will need a MySQL database; it can be an empty database since the "Form to Database" Dreamweaver Extension will create the required table and fields automatically.
  2. Your will need a server with support for PHP scripts. If your server supports MySQL databases then it probably supports PHP scripts.
  3. You will need Dreamweaver. The extension works with the following Dreamweaver versions: MX, MX 2004, DW 8, CS3, CS4, CS5.... and any newer Dreamweaver version.
  4. ...and finally you will need to download and install the Form to Database Dreamweaver extension.

Form to Database Configuration DialogNow what? Open your Dreamweaver, open the page that contains the form that you want to save to a database and follow these steps:

  1. Click anywhere into the form to select it
  2. Go to the Dreamweaver Commands menu and click the option named "Insert FormToDatabase"
  3. A dialog will be opened and you will be asked for some details like the database access details, the password that you want to use for accessing the admin area (yes, it has an admin area to browse the data), the email address where you want to receive the notification every time that a form is filled (another feature included in the product) and other basic details.
  4. Click OK, upload your form and the "HDWFormToDatabase" folder to the online web site and you are ready to test it!

At this point you have a form that automatically saves into a database the information submitted. As you can see the process is quite simple. If your server supports ASP instead PHP then you can use the ASP Form to Database, it's a similar tool for servers with Windows/ISS and MSAccess or MSSQL databases.

Now let's talk a bit about the additional features provided by the "Form To Database" extension:

  • The administration panel: It's a web panel that can be used to browse the data saved into the database (from your web form) and can be also use to edit and delete the data. Additionally it allows exporting the data to a CSV/Excel file. Thanks to this administration panel we don't have to deal with other MySQL database tools to see, edit, delete and export the data.
  • The notification email: An email is sent to the specified email address (ex: the website owner address) every time that a form is filled and submitted. The notification email contains a copy of all the data entered into the form. This is pretty useful to get notified of each submission and to check the data directly into the email.
  • Uploads: If you put a file field into your form, the "Form To Database" extension will upload the file automatically to your website. A copy of the file will be included as an attachment into the notification email and a reference to it will be places into the database.

database administration area
Img.2 - Database Administration Area.

There are other minor features offered by this tool, but let's think a bit more about the latest two mentioned: automatically sends the form to an email address and automatically processes file uploads. Each one of these features requires usually a big hassle to be implemented, but in this case have been included just as additional features that don't require extra work.

For all the above the Form To Database extension is currently one of the best tools that can be added to your Dreamweaver.