Xah Lee, 2005-05, 2010-10-21
This file is a example of all the basic GUI element of HTML form.
A form is done by the tag FORM. Like this:
<form action="http://example.com/cgi-bin/myProcessFormScript" method="post" enctype="application/x-www-form-urlencoded"> … </form>
Inside the form tag, are tags like INPUT, TEXTAREA, SELECT. These tags are shown in browser as graphical user interface widgets, such as text field, checkboxes (multiple selection), radio buttons and menus (single selection), buttons. When user presses the submit button, the data is sent to the a script to process. The script is specified in the value of the “action” attribute in the form tag.
From the program input point of view, the inputs user generates by submitting a form are just a list of name/value pairs. In the case of GUI element such as check boxes that returns multiple results, the value is a list.
<!-- The data encoding type, enctype, MUST be specified as below --> <form enctype="multipart/form-data" action="xyz.php" method="POST"> <div> <!-- MAX_FILE_SIZE must precede the file input field --> <input type="hidden" name="MAX_FILE_SIZE" value="30000"> <!-- Name of input element determines name in $_FILES array --> Send this file: <input name="userfile" type="file"> <input type="submit" value="Send File"> </div> </form>
References: