form-tag

       You can make formulas in XHTML - a collection of fields and menues, so users can type in their information, and send it to the webserver, that might then produce e.g. an email, or put it in a database.
       The most important tag in this connection is form, surrounding all of the formula. form takes a number of attributes. One of them is action - here you write the name and place of the script, that's supposed to get data from the formula. Another one is method, showing how the data should be sent. If you choose get, you will later see data as part of the URL, at the top of the browser. If you choose post, data is sent in another way. Post makes it possible to send more data, and is safer, so normally it is preferred in formulas.
       Inside the formula, the most important tag is input, making type in fields, buttons etc. possible. input takes among other things the attribute type, that might have the values text (ordinary text), password (like text, but on the screen the typed will be shows as stars), hidden (also text, but the value won't be shown on the screen), submit (a button, that sends the data), image (also a button, but here a picture can be used), checkbox and radio (two different ways to make fields, that accept clicks).
       There are also other tags for use in formulas. select is a tag, that can surround one or more option tags. The result is a menu, one line for every option.
       An example.

<form action="http://stream.imma.dk/lisea/bog/dok/visalt.php"
method="POST" name="creation" onSubmit="return afsendelse(this)">
<input type="hidden" name="secret" value="A secret field" />
Name: <input type="text" name="navn" /><br />
Type: <select name="type">
<option>Player</option>
<option>Administrator</option>
</select><br />
<input type="submit" />
</form>
       This formula calls the script visalt.php (show all) - and I know it just shows all the variables and values, the script got. There's a secret field, a text field, a menu and a button. It's important the fields have names, because these names go on to the script. Over there I can tell the difference between e.g. secret and name. When the data are submitted a javascript function is called, that will either approve the content, or reject the submission.

Concept last updated: 15/04 2004.

Relations

is a kind of

Other sources

Forfatterværktøj / udviklingsmiljø form-tag Formatteringssprog

Libellus