7.3 Designing a formThis is NOT the latest copy of this book; click here for the latest version.
A "form" on the web is considered to be zero or more form elements, plus a submit button. These forms are designed to electronically replicate the forms we've all filled in hundreds of times before in real life - signing up for a bank account, a passport, etc. You start your form using the <FORM> HTML tag, and therefore you end with </FORM>. By separating forms like this, you can have multiple forms on one page.
Given the above definition, here is the most basic form in HTML:
<FORM>
<INPUT TYPE="submit" />
</FORM>
What does it do? Well, very little, really - it will simply show a button with "Submit Query" written on, which will not submit any data when clicked. The screenshot below is how it looks in Konqueror running on Linux:

There are two key attributes to the <FORM> tag that you should be aware of and use: action, and method. Action sets the location of the page that will handle the results of the form - the place where the variables should be sent. Method describes how the data should be submitted, and you have two options: GET and POST.
|
Want to see this stuff in print? PHP in a Nutshell takes the core topics covered here, adds in thousands of edits from the editorial team and myself, and combines them to make an unbeatable reference for PHP programmers at all levels.
My latest book has hundreds more tips on how to use PHP, Apache, and MySQL, plus Perl, Python, shell scripts, performance tuning, and more!
|