TOC

This article is currently in the process of being translated into Hungarian (~10% done).

Forms:

Sending the Data

Most ebben pillanatban még nem beszéltünk hogyan küldi el valójában az adatot amit bevitt a felhasználó. Elküldheted a email címedre, egy másik oldalra, vagy az adatbázisodnak.

Whichever option you choose, you always have to define how the browser handles the user input. This is defined through the method attribute, which can have one of two values – post or get.

<form action="url-to-formmail-provided-by-your-ISP" method="post">

The get value ensures that the data is to be encoded by the browser into a url and post means that the data is sent to a database or your email. This means, that generally you will use the post value as it is used for form submissions.

The easiest way to handle your data is to send it to your email. All you have to do is add the action attribute to the form element and the method attribute. The action attribute tells the browser what to do with the content of your form and the method attribute tells the browser how to handle it. Here is an example:

<form action="mailto:your@email.com" method="post">
	First name: <input type="text" name="firstname" /> 
	Surname: <input type="text" name="surname" />
	<input type="submit" value="Submit now" />
</form>

If you choose to use this method you need to be aware that the functionality depends on the email-client installed on your users’ computer. This means, that not all users will be able to use your form.

Otherwise you could use the formmail, which I mentioned earlier. When using a formmail, the value of the method attribute should always be post as you are sending the data.

This article has been fully translated into the following languages: Is your preferred language not on the list? Click here to help us translate this article into your language!