Web Design and Publishing

How do you create a web form to collect data?

User Avatar
Wiki User
May 26, 2009 12:56PM

Use the HTML <form> tag, setting its "action" attribute to the address of the page that the data will be sent to.

Each form item should have a name attribute, and the submit button will send the data to the receiving page.

This receiving page must use code to retrieve the data. The most common language is PHP, where you can use the $_GET[] and $_POST[] variables to retrieve the data.

You can specify whether to use GET or POST in the <form> tag - the method attribute can be set to either "get" or "post". Any other value is invalid in W3C code.

GET sends the data through the URL of the page, while POST sends the data behind the scenes. This makes it securer, but more difficult for the user to bookmark the page.