button
Google Custom Search
 

How to create a form

Forms are used primarily to collect information from your visitors.
Example: "Enter your email address to receive our newsletter". They send you their email address and you send them your newsletter.

The form

This is a simple form that will collect the name and email address from a visitor and send that information to you.

  • action= this form is going to send mail to the address you supply.
  • method="post" the form will post the information.
  • input type="text" your visitor is going to put text into the input field (box).
  • name="name" what is going to be put into the box. In this case, their name.
  • size="20" the size of the box, 20.
  • input type="submit" when you use submit, your browser shows a button.
  • value="" this shows on your form inside the button or box. In this case its Send.

<form action=mailto:"you@yoursite.com" method="post" enctype="text/plain" />
Name:<br />
<input type="text" name="name" size="20" /> <br />
Email Address:<br />
<input type="text" name="email" size="20" /> <br />
Comment:<br />
<input type="text" name="comment" size="40" /> <br /> <br />
<input type="submit" value="Send" />
<input type="reset" value="Reset" />
</form>

The finished form

Name:

Email Address:

Comment:


View web page

The action attribute

The action attribute specifies the address where you will complete the form, this means that you must indicate here, the location of the page that will process the form. In the form above the action is "mailto".

The method attribute

The method attribute specifies how you are going to submit the form. It specifies which HTTP method you will use to send the form's contents. There are two types POST and GET.

In the form above we used the POST method because we wanted the data that we send to be hidden. The GET method should not be used to submit sensitive data.

Enctype

The enctype method specifies your form data. This determines the mechanism used to encode the form's contents. The default for POST and GET is application/x-www-form-urlencoded and does not need to be specified.

NOTE: Once you have placed a (basic HTML form) on your web site you will learn, like we all did, that spammers love them! Unscrupulous people will use your form to send spam, and you, will never know.

I don't advise using an html form on your web site because of this problem. The best way to stop spammers is to use a more advanced PHP form. I use PHP forms and have several on this web site. You can see a PHP form in action by going to our Contact us page and you can download a free PHP form here.

It takes a little time to install a PHP form if you are not familiar with PHP, but, you can do it.
YOU MUST HAVE LINUX HOSTING TO USE PHP! Go here to learn about hosting platforms.

go to the next terrific page To add a link to your web page

Welcome to Pro-dezign Web Essentials, your IP address is: 38.103.63.60 and you came from: Page was directly requested

 

xhtml 1.0 strict