Make your own free website on Tripod.com

 


Menggunakan Form

Form di gunakan untuk melakukan interaksi dengan pengujung situs, misalnya untuk mendapatkan pesan dari pengunjung, melakukan pendaftaran suatu layanan keanggotaan,  pemesanan barang dan sebagainya.

Untuk menggunakan Form,Tag yang dipakai adalah tag <FORM></FORM>.Sementara atribut yang digunakan adalah METHOD= dan ACTION. Dan penggunaannya sebagai berikut

<FORM METHOD="pos\get" ACTION="alamat_URL">  

</FORM>

Form bekerja dengan mengirimkan data yang di ketik atau di pilih pengunjung situs ke suatu scripts program (seperti CGI scripts, php atau pl) yang berada di alamat_URL. Scripts seperti itu bisa di peroleh gratis di http://www.cgi-resources.com 

Untuk menggunakan form sebaiknya kita perlu melanjutkan ke tahapan yang lebih mahir dengan mempelajari CGI, Php dan atau perl. Namun tanpa mengerti  pemrograman tersebut anda tetap bisa menggunakan Form di situs anda yaitu dengan menempatkan fasilitas Guesbook atau buku tamu gratis yang akan kita bahas pada bab selanjutnya.




Contoh Penggunaan Form

*** QUICK INDEX OF FORM INPUTS ***

Text
Password
Radio Buttons

        Good
        Better
        Best
        Super Dooper

Check Boxes
       Gone With the Wind
       Dr Zhivago
       Ben Hur
       Tommy Boy
Textarea

Pull Down List
Scrolling List
Hidden
Submit & Reset

HASIL DIATAS BERASAL DARI KODE HTML BERIKUT

<CENTER><TABLE WIDTH=500 BORDER=1 CELLSPACING=0 CELLPADDING=8>

<TR>

<TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=250>

<FONT SIZE=4><STRONG><A HREF="lesson02.htm#text">Text</A></STRONG></FONT><BR>

<FORM METHOD=POST ACTION="mailto:xxx@xxx.xxx" ENCTYPE="application/x-www-form-urlencoded">

<INPUT TYPE=TEXT SIZE=20></FORM>

</TD>

<TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=250>

<FONT SIZE=4><STRONG><A HREF="lesson02.htm#password">Password</A></STRONG></FONT><BR>

<FORM METHOD=POST ACTION="mailto:xxx@xxx.xxx" ENCTYPE="application/x-www-form-urlencoded">

<INPUT TYPE=TEXT SIZE=20 VALUE="*********"></FORM>

</TD>

</TR>

<TR>

<TD VALIGN=MIDDLE WIDTH=250>

<CENTER><FONT SIZE=4><STRONG><A HREF="lesson02.htm#radio">Radio Buttons</A></STRONG></FONT></CENTER><BR>

<FORM METHOD=POST ACTION="mailto:xxx@xxx.xxx" ENCTYPE="application/x-www-form-urlencoded">

<KBD>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</KBD>

<INPUT TYPE=RADIO NAME="BEST FRIEND" VALUE="Good" CHECKED> Good<BR>

<KBD>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</KBD>

<INPUT TYPE=RADIO NAME="BEST FRIEND" VALUE="Better"> Better<BR>

<KBD>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</KBD>

<INPUT TYPE=RADIO NAME="BEST FRIEND" VALUE="Best"> Best<BR>

<KBD>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</KBD>

<INPUT TYPE=RADIO NAME="BEST FRIEND" VALUE="Best"> Super Dooper<P>

</FORM>

</TD>

<TD VALIGN=MIDDLE WIDTH=250>

<CENTER><FONT SIZE=4><STRONG><A HREF="lesson02.htm#check">Check Boxes</A></STRONG></FONT></CENTER>

<FORM METHOD=POST ACTION="mailto:xxx@xxx.xxx" ENCTYPE="application/x-www-form-urlencoded">

<KBD>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</KBD>

<INPUT TYPE=CHECKBOX NAME="Gone" VALUE="YES" CHECKED> Gone With the Wind<BR>

<KBD>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</KBD>

<INPUT TYPE=CHECKBOX NAME="Dr" VALUE="YES"> Dr Zhivago<BR>

<KBD>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</KBD>

<INPUT TYPE=CHECKBOX NAME="Ben" VALUE="YES"> Ben Hur<BR>

<KBD>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</KBD>

<INPUT TYPE=CHECKBOX NAME="TOMMY BOY!" VALUE="YES" CHECKED> Tommy Boy<BR>

</FORM>

</TD>

</TR>

<TR>

<TD ALIGN=CENTER VALIGN=MIDDLE COLSPAN=2 WIDTH=500>

<FONT SIZE=4><STRONG><A HREF="lesson03.htm#textarea">Textarea</A></STRONG></FONT><br>

<FORM METHOD=POST ACTION="mailto:xxx@xxx.xxx" ENCTYPE="application/x-www-form-urlencoded">

<CENTER>

<TEXTAREA NAME="COMMENTS" ROWS=7 COLS=54>

___ ____ ___

____( \ .-' `-. / )____

(____ \___ / (O O) \ ___/ ____)

(____ `----( ) )----' ____)

(____ __________\ .____. /__________ ____)

(______/ `-.____.-' \______)

</TEXTAREA>

</CENTER>

</FORM><P>

</TD>

</TR>

<TR>

<TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=250>

<FONT SIZE=4><STRONG><A HREF="lesson03.htm#pulldown">Pull Down List</A></STRONG></FONT><BR>

<FORM METHOD=POST ACTION="mailto:xxx@xxx.xxx" ENCTYPE="application/x-www-form-urlencoded">

<SELECT NAME="BEST FRIEND">

<OPTION VALUE="for">Lions

<OPTION VALUE="this">and

<OPTION VALUE="it">Tigers

<OPTION VALUE="doesnt">and

<OPTION VALUE="really">Bears

<OPTION VALUE="matter">Oh my!

</SELECT>

</FORM>

</TD>

<TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=250>

<FONT SIZE=4><STRONG><A HREF="lesson03.htm#scrolling">Scrolling List</A></STRONG></FONT><BR>

<FORM METHOD=POST ACTION="mailto:xxx@xxx.xxx" ENCTYPE="application/x-www-form-urlencoded">

<SELECT NAME="BEST FRIEND" SIZE=3>

<OPTION VALUE="for">People

<OPTION VALUE="this">who

<OPTION VALUE="it">feed

<OPTION VALUE="doesnt">tacos

<OPTION VALUE="really">to

<OPTION VALUE="matter">a

<OPTION VALUE="What">dog

<OPTION VALUE="are you">should

<OPTION VALUE="looking">be

<OPTION VALUE="at!">SHOT!

</SELECT>

</FORM>

</TD>

</TR>

<TR>

<TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=250>

<FONT SIZE=4><STRONG><A HREF="lesson04.htm#hidden">Hidden</A></STRONG></FONT><BR>

<FORM METHOD=POST ACTION="mailto:xxx@xxx.xxx" ENCTYPE="application/x-www-form-urlencoded">

<INPUT NAME="yes" TYPE=hidden VALUE="Yes there really is a hidden input here">

</FORM>

</TD>

<TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=250>

<FONT SIZE=4><STRONG><A HREF="lesson04.htm#submit">Submit & Reset</A></STRONG></FONT><BR>

<FORM METHOD=POST ACTION="mailto:xxx@xxx.xxx" ENCTYPE="application/x-www-form-urlencoded">

<INPUT TYPE=SUBMIT VALUE="Submit">

<INPUT TYPE=RESET VALUE="Reset">

</FORM>

<FORM><INPUT TYPE="button" Value=" Don't Press This Button "

onClick="alert('I thought I told you not to press it!')

;alert('This is not really a part of HTML forms. It\'s actually Javascript. But it does use form tags.')

;alert('Is this starting to get annoying??')

;alert('It\'s your fault... I told you not to press the button!')")>

</FORM>

</TD>

</TR>

</TABLE></CENTER>

 



KEMBALI KE DAFTAR ISI



By Joko Setiawan, Klaten, 10 Juni 2003.