The Form Tag
The Form Tag
start with the form tag, an example of how to use the the mailto tag in a html form when the user clicks the submit button the user's browser will send the information to someone@$nailmail.com in this case
<FORM MET O!"#O$T %&T'O(")mailto*someone+,nailmail-com) E(&T.#E")text/plain)0 </FORM0
<'(#2T T.#E")radio) (%ME")(E=$;ETTER) :%;2E")$2>&R'>E) & E&?E!0 $ubscribe <'(#2T T.#E")radio) (%ME")(E=$;ETTER) :%;2E")2($2>$&R'>E)0 2nsubscribe <>R0 <'(#2T T.#E")radio) (%ME")%TT%& ME(T) :%;2E")'(&;2!E) & E&?E!0 'nclude attachment <'(#2T T.#E")radio) (%ME")%TT%& ME(T) :%;2E")(OT3 '(&;2!E)0 !on't include attachment
The checkbox
't ma1 help to think of the checkbox as the opposite of a radio input because the 'name' changes and the '9alue' sta1s the same
option 5 option 6 option @ option A
data can be sent to multiple email address's, simpl1 seperate the address's with commas
someone+,nailmail-com, someoneelse+,nailmail-com, noone+,nailmail-com
<'(#2T T.#E")checkbox) :%;2E").E$) (%ME")O#T'O(5) & E&?E!0 option 5 <'(#2T T.#E")checkbox) :%;2E").E$) (%ME")O#T'O(6)0 option 6 <'(#2T T.#E")checkbox) :%;2E").E$) (%ME")O#T'O(@) & E&?E!0 option @ <'(#2T T.#E")checkbox) :%;2E").E$) (%ME")O#T'O(A)0 option A
Bust as it is possible to create more than one 'set' of radio buttons b1 changing the 'name' additional checkbox catagories or options can be included b1 changing the '9alue'
since information in html forms is sent as a name/9alue pair the text input must ha9e a 'name', the 9alue is whate9er the user t1ped in or a 9alue could be gi9en
hello w orld
<'(#2T T.#E")text) (%ME")$E&O(!3'TEM) $'4E"68 :%;2E")hello world)0
The textarea
(ote that 'textarea' has a closing tag,
<TECT%RE% (%ME")&OMME(T$) RO=$"5D &O;$"6D0 </TECT%RE%0
input password t1pe is 9er1 similar exept it displa1s the < s1mbol instead of alpha numeric characters
t1pe someting in <'(#2T (%ME")#%$$) T.#E")password) $'4E"560
note also that an1thing t1ped between the textarea opening and closing tags will be formated exactl1 as it was t1ped b1 most browsers
<TECT%RE% (%ME")&OMME(T$) RO=$"5D &O;$"6D RE%!O(;.0 this textarea is AD 'cols' wide and 5D 'rows' in height </TECT%RE%0
radio buttons must ha9e a '9alue', radio inputs should ha9e the same 'name' because the1 onl1 gi9e the user one possible option 't is possible to offer the user more options with radio inputs b1 gi9ing them a different 'name'
$ubscribe 2nsubscribe !on't include attachment
'nclude attachment
1|Page
when using name="next_url" a full and complete web address should be included in the '9alue' part of the tag
'n this next example 'submit' and 'reset' are gi9en a '9alue'
<INPUT T(PE="su)*$t" VALUE="S +""> <INPUT T(PE="r s t" VALUE="C% ar">
the image submit button it's eas1 to substitute an image for the submit button, in ut!t" e="su#mit" and in ut!t" e="ima$e" are interpreted b1 the browser as one and the same
<INPUT T(PE="$*ag " SRC="s ar,h-g$.">
(ote that one of the items on the list is '$E;E&TE!' otherwise the default selected option would be the top one FEggsG 't's simple to transform the drop menu into a scrolling menu b1 adding a si7e to the <SELECT> tag
<SELECT NAME="INGREDIENTS" SIZE=4> <OPTION VALUE="EGGS" SELECTED>Eggs <OPTION VALUE="PASTA">Pasta <OPTION VALUE="SUGAR">Sugar <OPTION VALUE="CHEESE">Ch s <OPTION VALUE="!READ">!r a" <OPTION VALUE="MIL#">M$%& <'SELECT>
't should be noted that older browser tend not to support this t1pe of input and when this input is used in a mailto form, the results can sometimes be unpredictable-
about nextHurl a 9er1 special hidden input t1pe uses name="next_url" to send the user to a specific page after the form is submited, howe9er this onl1
using the c$i!%orm!)an(lin$ will usuall1 be found on the ser9er's )el or *+, page =hen using a cgi form the action will be set to something like this--%&T'O(")/cgi3bin/mail-pl)
<font si7e"5 face")arial) color")LDDDDDD)0 <'(#2T t1pe"checkbox name")html) 9alue")sendme) & E&?E!0 i can reci9e email as html<>R0 <'(#2T t1pe"checkbox name")receipt) 9alue")sendme)0 send me a recipt for this email<>R0 </font0 <TECT%RE% cols"6D rows"5D0 e1 N what do 1ou think of the formO cool huhO </TECT%RE%0<br0 <center0 <'(#2T (%ME")redirect) T.#E")hidden) :%;2E")index-html)0 <'(#2T (%ME")(ECTH2R;) T.#E")hidden) :%;2E")index-html)0 <'(#2T t1pe"submit 9alue"$end0 <'(#2T t1pe"reset 9alue")&lear)0 </center0 </td0</tr0</table0 </FORM0 <N33 << E(! OF FORM << 330
'f 1our ser9er has a cgi bin 1ou ma1 e9en be able to run 1our own cgi script, there are man1 scripts of this kind freel1 a9ailable on the web and if there is no cgi access a9ilable on 1our ser9er whatsoe9er then there are free remotel1 hosted cgi form handling scripts a9ailable for use b1 an1one
<FORM MET O!"#O$T %&T'O(")mailto*someone+,nailmail-com) E(&T.#E")text/plain)0 <table border"D cellspacing"D cellpadding"60 <tr0 <td colspan"60 <font si7e"6 face")arial) color")LDDDDDD)0 <'(#2T t1pe")text) name"2R; si7e"5M 9alue")http*//)0 *.our 2R;<>R0 <'(#2T t1pe")text) name"user si7e"5M0 *.our 2sername<>R0 <'(#2T t1pe")text) name"email si7e"5M0 *.our E3 mail </font0 </td0 </tr0 <tr0 <td0 <font si7e"5 face")arial) color")LDDDDDD)0 <'(#2T name"subscribe t1pe"radio 9alue")1es) & E&?E!0 subscribe<>R0 <'(#2T name"subscribe t1pe"radio 9alue")no)0 unsubscribe<>R0 </font0 </td0 <td0 <$E;E&T name")choices) si7e"50 <O#T'O( selected0 O#T'O($ <O#T'O(0 O#T'O( 5 <O#T'O(0 O#T'O( 6 <O#T'O(0 O#T'O( @ <O#T'O(0 O#T'O( A <O#T'O(0 O#T'O( 8 </$E;E&T0 </td0 </tr0 <tr0 <td colspan"60
<form id="contact-form" action="script.php" method="post"> <fieldset> <legend>Contact Us:</legend> <ul> <li> <la el for="name">!ame:</la el> <input t"pe="te#t" name="name" id="name" $alue="" /> </li> <li> <la el for="email">%mail:</la el> <input t"pe="te#t" name="email" id="email" $alue="" /> </li> <li> <la el for="comments">Comments:</la el> <te#tarea name="comments" id="comments" cols="2&" ro's="("></te#tarea> </li> <li> <la el for="mailing-list">)ould "ou li*e to sign up for our mailing list+</la el> <input t"pe="chec* o#" chec*ed="chec*ed" id="mailing-list" $alue=",es- sign me up." /> </li> <li> <input t"pe="su mit" $alue="su mit" /> <input t"pe="reset" $alue="reset" /> </li> </ul>
(|Page
</fieldset> </form>
<html> <head> <title>Student Registration Form</title> </head> <body> <br /> <br /> <center> <form id="form1" name="form1" method="post" action=""> <table width="41 " border="1" cellspacing="!" cellpadding="!"> <tr> <td colspan=" "><di" align="center"><strong>Student Regstration Form</strong></di"></td> </tr> <tr> <td width="11#">$ame</td> <td width=" %&"> <input type="te't" name="name" si(e="4!"/> </td> </tr> <tr> <td "align="top">)ddress</td> <td><te'tarea name="address" cols="4%" rows="%"></te'tarea></td> </tr> <tr> <td "align="top">Se'</td> <td><input type="radio" name="se'*+" "alue="F" /> Female <input type="radio" name="se'*+" "alue="," /> ,ale</td> </tr> <tr> <td colspan=" " "align="top" align="right"> <input type="submit" name="Register" "alue="Register"/> <input type="reset" /> </td> </tr> </table> <p>-nbsp.</p> <p>-nbsp.</p> </form> </center> </body> </html>
<form name="htmlform" method="post" action="html/form/send.php"> <ta le 'idth="0&1p#"> </tr> <tr> <td $align="top"> <la el for="first/name">2irst !ame 3</la el> </td> <td $align="top"> <input t"pe="te#t" name="first/name" ma#length="&1" si4e="(1"> </td> </tr> <tr> <td $align="top""> <la el for="last/name">5ast !ame 3</la el> </td> <td $align="top"> <input t"pe="te#t" name="last/name" ma#length="&1" si4e="(1"> </td> </tr> <tr> <td $align="top"> <la el for="email">%mail 6ddress 3</la el> </td> <td $align="top"> <input t"pe="te#t" name="email" ma#length="71" si4e="(1"> </td> </tr> <tr> <td $align="top"> <la el for="telephone">8elephone !um er</la el> </td> <td $align="top"> <input t"pe="te#t" name="telephone" ma#length="(1" si4e="(1"> </td> </tr> <tr> <td $align="top"> <la el for="comments">Comments 3</la el> </td> <td $align="top"> <te#tarea name="comments" ma#length="1111" cols="2&" ro's="9"></te#tarea> </td> </tr> <tr> <td colspan="2" st"le="te#t-align:center">
0|Page
<input t"pe="su mit" $alue=":u mit"> ; <a href="http://'''.freecontactform.com/html/form.ph p"><8=5 2orm</a> > </td> </tr> </ta le> </form> <html> < od"> <form tag="Create 5ogon"> <di$ align="center"> Username 3: <input t"pe="username" name="username" />< r /> Pass'ord 3: <input t"pe="pass'ord" name="p'd" />< r /> :urname 3: <input t"pe="surname" name="surname" />< r /> ?ther !ames 3: <input t"pe="other names" name="names" />< r /> @ate of Airth 3: <input t"pe="date of irth" name="do " />< r /> %mail 3: <input t"pe="email" name="email" />< r /> 8elephone: <input t"pe="telephone" name="tel" />< r /> 6ddress 3: <input t"pe="address" name="add" />< r /> Post Code 3: <input t"pe="postcode" name="ptc" />< r /> <input t"pe="su mit" $alue=":u mit" /> </di$> </form> <p>Note: Please ma*e sure "our details are correct efore su mitting form and that all fields mar*ed 'ith 3 are completed..</p> </ od"> </html> <<8=5> <<%6@><8B85%><omePage</8B85%></<%6@> <A?@,> 8his is <omePage <<C> <=6CDU%%>))).A??E:.C?=</=6CDU%%> <B=F :CC=".G oo*.gif" height="(1H" 'idth="01H"> <PC%> <6 <C%2=".G<omePage1.html"><ome Page</6> <6 <C%2=".GCegistration1.html">Cegistration User 5ogin</6> &|Page
<6 <C%2=".GUserProfile1.html">User Profile Page</6> <6 <C%2=".GAoo*sCatalog1.html">Aoo*s Catalog</6> <6 <C%2=".G:hoppingCart1.html">:hopping Cart</6> <6 <C%2=".GPa"ment1.html">Pa"ment A" CreditCard</6> <6 <C%2=".G?rderConfirmation1.html">?rder Confirmation</6> </PC%> </A?@,> </<8=5> <<8=5><<%6@><8B85%>Cegistration</8B85%></< %6@> <A?@,>8his is Cegistration User 5ogin<<C> <=6CDU%%>))).A??E:.C?=</=6CDU%%> <B=F :CC=".G oo*.gif" height="(1H" 'idth="01H"> <PC%><6 <C%2="G)%A:B8%G<omePage.html"><ome Page</6> <6 <C%2=".G<omePage1.html"><ome Page</6> <6 <C%2=".GCegistration1.html">Cegistration User 5ogin</6> <6 <C%2=".GUserProfile1.html">User Profile Page</6> <6 <C%2=".GAoo*sCatalog1.html">Aoo*s Catalog</6> <6 <C%2=".G:hoppingCart1.html">:hopping Cart</6> <6 <C%2=".GPa"ment1.html">Pa"ment A" CreditCard</6> <6 <C%2=".G?rderConfirmation1.html">?rder Confirmation</6> </PC%><2?C=><pre> %nter "our !ame :<B!PU8 8,P%="8%I8"> %nter Pass'ord :<B!PU8 8,P%="P6::)?C@"> Confirm Pass'ord:<B!PU8 8,P%="P6::)?C@"> Fender :<Bnput t"pe="Cadio" name="C1" $alue="=ale">=ale <Bnput t"pe="Cadio" name="C1" $alue="2emale">2emale Countr" :<select><option selected>:elect Countr"</option> <option $alue="ind">Bndia</option> <option $alue="usa">United :tates of 6merica</option> <option $alue="eng">%ngland</option> <option $alue="aus">6ustralia</option> <option $alue="ger">Ferman"</option> <option $alue="pol">Poland</option> </select><center><Bnput t"pe="su mit"><input t"pe="reset"></center> </pre></form></A?@,></<8=5>
<<8=5><<%6@><8B85%>Pa"ment A" Credit Card</8B85%></<%6@> <A?@,> <=6CDU%%>))).A??E:.C?=</=6CDU%%> <B=F :CC=".G oo*.gif" height="(1H" 'idth="01H"> <PC%> <6 <C%2=".G<omePage1.html"><ome Page</6> <6 <C%2=".GCegistration1.html">Cegistration User 5ogin</6> <6 <C%2=".GUserProfile1.html">User Profile Page</6> <6 <C%2=".GAoo*sCatalog1.html">Aoo*s Catalog</6> <6 <C%2=".G:hoppingCart1.html">:hopping Cart</6> <6 <C%2=".GPa"ment1.html">Pa"ment A" CreditCard</6> <6 <C%2=".G?rderConfirmation1.html">?rder Confirmation</6> </PC%> <ta le order=1 cellpadding=1 cellspacing=1 'idth=011> <tr><th>)hat 'ill it ta*e to pa" off m" credit card+</th></tr> <tr><td align=center> <ta le cellpadding=2 cellspacing=1> <tr><td align="right">%nter "our credit card alance: J</td><td><input si4e=9 t"pe=te#t id="c'Aalance"></td></tr> <tr><td align="right">%nter the credit cardKs interest rate: </td><td><input si4e=9 t"pe=te#t id="c'Cate">H</td></tr> <tr><td align="right">%nter pa"ment amount per month: J</td><td><input si4e=9 t"pe=te#t id="c'=onthl"6mount"></td></tr> <tr><td align="center">< >or</ ></td><td> </td></tr> <tr><td align="right">%nter desired months until de t free: </td><td><input si4e=9 t"pe=te#t id="c'@esired=onths"></td></tr> 9|Page
<tr><td colspan=2 align="center"><input t"pe= utton $alue="Calculate" onclic*="c'Calc;>L"></td></tr> <tr><td colspan=2 align="center" id="c'Cesult"></td></tr> </ta le></td></tr> </ta le> </A?@,> </<8=5>