WHAT IS A FORM?
A general form has the structure:Top<form method=post action="what-to-do-with-contents"> Form Elements </form>If it does not have a submit button, there is (almost) no way for the information the user enters in the form to be processed.There is also a method=get. Post sends all information to the action as input (more precisely, to <STDIN>); Get appends the name/value pairs to the action as an extended URL. Get is deprecated in HTML 4.0, so it might be a good call to avoid it.
HOW DO FORM ELEMENTS
WORK?
WHAT ACTIONS ARE THERE?
The only simple action that doesn't require programming is a mailto action. This can be done with or without an enctype (encoding type) attribute in the form tag. It's probably best to use the enctype attribute. As an example, consider the form:
With and without an enctype attribute, this e-mails:<form action="mailto:glarose@NebrWesleyan.edu" method=post> Your name:<br> <input type="text" name="name" size=10><br> Your email address:<br> <input type="text" name="email" size=10><br> Your relationship to the department:<br> <textarea name="relate" rows=3 cols=60 wrap="physical"></textarea><br> Comments:<br> <textarea name="comments" rows=10 cols=60 wrap="physical"></textarea><br> <input type="submit" value="submit form"><br> <input type="reset" value="reset form"><br> </form><br>
Form tag | Form tag with enctype |
<form action="mailto:glarose@NebrWesleyan.edu" method=post> | <form action="mailto:glarose@NebrWesleyan.edu" method=post enctype="text/plain"> |
E-mails | E-mails |
To: glarose@NebrWesleyan.edu Subject: Form posted from Mozilla Content-type: application/x-www-form-urlencoded Content-Length: 223 name=Gavin+LaRose&email=glarose@Nebr Wesleyan.edu&relate=I+teach+here%21& comments=Nifty+Web+pages%21(the e-mail body is really all one line) |
To: glarose@NebrWesleyan.edu Subject: Form posted from Mozilla Content-type: text/plain Content-Disposition: inline; form-data Content-Length: 209 name=Gavin LaRose email=glarose@NebrWesleyan.edu relate=I teach here! comments=Nifty Web pages! |
The catch with a mailto form is that it relies on the browser to correctly format the text that it sends you, which it might or might not actually do. The other catch is that it doesn't allow you to do anything with the data other than have it e-mailed to you, and doesn't send a "thank you note" or other reply to the user.
To get around these problems requires a foray into programming, to have a program that will take the input (the content of the left-hand e-mail message in the table above), decode it, and then do something with it.
Top |