|
|
 |
 |
 |
 |
Tutorials - Creating Simple Forms
Getting feedback from visitors can be rewarding, and forms is a way to do it. You don't need CGI access to do them either, you can make them using standard HTML.
First, we need to tell the form where to be sent when they press 'Submit'.
<form name="testform" method="POST" action="mailto:YOUR E-MAIL ADDRESS?subject=YOUR SUBJECT" enctype="text/plain">
You will notice that the form name is 'testform' you can change that to whatever you like. Where is says YOUR E-MAIL ADDRESS, enter your own like yourname And finally enter a subject, this is what will be displayed as the subject in your e-mail program.
Leave text/plain as that is what makes it look pretty when you get it.
Now say if we want to ask their name, we need an input form feild for this.
<INPUT TYPE="TEXT" NAME="name_of_feild" SIZE=35 MAXLENGTH=50>
Okay, things to change in that. You can have as many as these in one form as you like, except you need to change the name of each one. So, if you called this one "name_of_feild" call the next one "e-mail" and so on. You can change the physical size of it if you wish, this is how long the white box will be on screen. MAXLENGTH is the maximun number of characters people can enter in the box. This is handy when so you don't get long garbage e-mails.
A drop down menu is handy as well in forms,
<SELECT NAME="my_browser" SIZE=1>
<option>Explorer 5
<option>Explorer 4
<option>Explorer 3
<option>Explorer 2
<option>Netscape 4
<option>Netscape 3
<option>Netscape 2
<option>Opera
<option>Other
</select>
Notice how this one is called "my_browser", when you get the e-mail all the names you called your questions or sections of the form will be listed. So so far your e-mail will look like this
name= their name
my_browser= what ever they choose
The SIZE in the drop down menu can be larger, have a look for yourself what this does, basicly if you say 5, it will look like the one on my main page where is shows more that one selection on screen.
Sometimes you may like a comment form, in this case a larger box would be handy, use TEXTAREA for this,
<TEXTAREA NAME="message" ROWS=5 COLS=45 value="" wrap=virtual scroll=0 scrollbars=0 MAXLENGTH=50></TEXTAREA>
Notice it will be 5 rows big and 45 colums wide, with no scroll bars. Let's make it so they can send the form.
<INPUT TYPE="submit" VALUE="Send Us Mail"><input type="reset" value=" Clear-Form">
</FORM>
And that is it, make sure you add the /FORM at the end of the form. You can also add tick boxes and circles too!
This is what the form above will look like on screen
The End.
|