HTML form: Create a contact form in HTML

Home / software / HTML form: Create a contact form in HTML

Even the simplest side often requires an HTML form. So that the visitor can enter data and submit it. We tell you how you wear in a contact form HTML and integrates into the website.

HTML form: Create a contact form in HTML

In this small HTML Course we would like to explain to you how you can create an HTML form itself and expand. Important is also on the different types as a form can be sent. For the determined, inter alia, the establishment of a contact form in HTML (and maybe some PHP).

make HTML forms itself

Forms have some special elements in HTML. There are text boxes and buttons, checkboxes and pull-down menus. For an introduction to should you read, for example, in SelfHTML manual. We have to assume that you already mastered basic rules of HTML coding. HTML forms are, how many HTML elements, initiated and terminated. You start with one such form <form ... and it ends with </shape>,

HTML forms-quelltextHTML forms can be easy - or extremely complicated

The simplest HTML contact forms consist of a start line, which submits the form via the email box of the visitor, some text fields, a submit button and the final day. Like this:

<form action ="mailto: empfaenger @"method ="post">Your first name and surname?<br><input type ="text" name ="Name first Name" value =""size ="30" maxlength ="50"><input type ="Submit" name ="" value ="send"></shape>

html-form-input-outputHere's how it looks then. Left you can see the form and on the right the email, which will send over the mail program in this form then. This is of course a little bit for a form. Submitting via mail account is also primitive and rather undesirable for visitors.

Start Photogallery(12 images)Google Tricks: New Features, Easter Eggs and assistance for the search engine

HTML form: Basic rules

Here are a few basic rules for an HTML form. These have to watch it, so that the form works at all.

  1. An HTML form starts with the HTML tag <form - followed by some instructions.
  2. The most important statement in an HTML form is action. The action command is followed by an equal sign and then quotes, between which is the actual command. As can be seen as above, one of the actions of the day mailto and an e-mail address can be. action =&# 8221; mailto: empfaenger @ 8221 ;.
  3. The introductory form tag still required to surrender a working method. For method there are the attributes post and get. get depends the form data to the requested URL and is used for further processing. post however, sends the data to the server where they can be sent via special programs. In such form scripts I go further below.
  4. To send the form requires a send button. input type =&Submit; # 8221&# 8221; specifies that a button is generated. The name is usually not important in this case. And = between the quotes of Value&# 8221;&# 8221; is what is written on the button. So, for example, Submit.
  5. So anything happens, you still need at least one form field. So for example, an input type =&# 8221; text&# 8221 ;, the text field is generated.
  6. Such fields need names and they must be unique and different. Then in the message that you receive each field name, followed by the value that the sender has entered there.
  7. The form is completed by </shape>

Send an HTML form &# 8211; possibilities

As mentioned above, the simplest version of an HTML form with the mailto command via the mail client of the visitor is sent. This is of course a very primitive way.

Much more effective are pre-prepared scripts that have been written in CGI or PHP and stored on the server. But this assumes that your web space also supports! Asks the provider if in doubt. In some cases, larger providers also provide ready-form solutions are available, which you can freely configure and integrate into your site.

html form-free php-scriptYour HTML forms can be sent by free form mail scripts

Such scripts can customize their e.g. download here. There is also a prepared contact form here. As a rule, you have to adapt only a few parameters, such as your e-mail address and the URL of the contact page. After that, the PHP functions of the server accept the mail shipment and send you the results clean formatted to.

Common errors in HTML contact forms

Above we have already mentioned some basic rules for HTML forms. There are some rookie mistakes, which ensure that the HTML contact forms are not even sent. Or the incoming results are incomplete.

Here is a list of the most common form errors and their reasons:



Only part of the requested data arrives.This often happens if you copy a form field and insert again. one forgets here to give the second field its own unique name, so there are two fields with the same name and in the best case, only one is sent.
The form is not transmitting.Either the action-Command error, or it was the wrong method selected. Checks both And if that does not work, check the parameters in the form of mail Skript.Weitere way!:

Your server does not support sending mail via PHP &# 8211; To ask!

Did you "HTML form: Create a contact form in HTML" fallen from Marco Kratzenberg?Write us in the comments or share the article.We look forward to your opinion - and of course you must like us on Facebook,twitter or Google+.