# ganti isi dari $link dibawah ini dengan alamat situs anda $link ="http://go-zila.tripod.com/"; # ini adalah file berisi database. Dalam latihan ini isi dari $ file tidak perlu anda rubah $file ="/results.txt"; #must be read/writable # ################################################################## if ($ENV{'REQUEST_METHOD'} eq 'POST') { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $contents{$name} = $value; } } chop($date = `date`); # Now with the program ########################################################### # Has to output a Content-type print "Content-type: text/html\n\n "; # Check to see if all required information was entered # Jika anda ingin tambahkan field,tambahkan disini. &no_cigar unless $contents{'nama'}; &no_cigar unless $contents{'alamat'}; sub no_cigar { print <<"HTML"; Form Tidak Lengkap

Form Tidak Lengkap

I'm sorry, the form was not filled completely.
Please Return to the form and fill it out completely.

Thank you.


Return to the $contents{'formname'} page HTML exit; } # They go here if the form was submitted # successfully. Now this page will send them # off to where ever specify in the "link" field above. print <<"HTML"; Entry Berhasil

Entry Berhasil!


$contents{'nama'}, I have received your form!

Your information will be processed immediately, $contents{'nama'}. Thank you.


Back to the home page. View this form's results. HTML #print "Content-type: text/plain\n\n "; open(OUTPUT, ">>$file"); print OUTPUT "_______________________________\n"; print OUTPUT "Date: $date\n"; print OUTPUT "FORM NAME: $contents{'formname'}\n"; print OUTPUT "NAMA: $contents{'nama'}\n"; print OUTPUT "ALAMAT: $contents{'alamat'}\n"; close (OUTPUT); exit;