Creating a Form Using Dreamweaver

First, place the insertion point where you want the form to appear, and choose Insert > Form.

Next, select the form and set form properties in the Property inspector. Choose from the following options:

Form Name: Assigns a name to the form. Naming a form makes it possible to control it with a scripting language.

Action: Identifies the server-side application that processes the form information, you can type a name of the PHP that will process the form.

Method: Defines how the form data is handled. The Method could be Get or Post. The default is usually Get.

So, if you have a form called form1 and it uses the method Get to send the form values to a php file called action.php, the HTML for the form would look like this:


<form method="get" action="action.php" name="form1">

</form>

Now you have to add some form objects inside your form, there are many kinds of objects, some of them are—

TestFields Accept any type of text, alphabetic or numeric.

Checkboxes Allow multiple responses in a single group of options.

Radio buttons Represent exclusive choices.

Buttons perform tasks when clicked, such as submitting or resetting forms.

Place the insertion point inside the form boundary, and choose an object from the Insert > Form Object menu.

This is a text Field

These are check boxes Music Health Travel

These are Radio Buttons Visa Master Card American Express

This is a button


Here is the HTML for the components above:


<input type="text" name="mytext"
value="This is a text Field you can Edit" size="30">

These are check boxes
<input type="checkbox" name="music" value="checkbox">Music 
<input type="checkbox" name="health" value="checkbox">Health 
<input type="checkbox" name="travel" value="checkbox">Travel These are Radio Buttons <input type="radio" name="payment" value="visa">Visa
<input type="radio" name="payment" value="master">Master Card
<input type="radio" name="payment" value="american">American Express
This is a button <input type="submit" name="Submit" value="click Me">

You can create a PHP program called action.php, which will process this form, and you would refer to the name of the variable for its value. So for an example the PHP program that displays the value entered by the client in the text field created above would look like—


<?php

echo $mytext; // prints the value entered by the user.

?>

Next (The Calculator Example)