1 / 15

BEKERJA DENGAN FORM

BEKERJA DENGAN FORM. Lisda Juliana P.,Ssi. FORM. Sintax : <form name=“ " method=“ " action=“ "> Name= nama form Action= lokasi dari script yang akan memproses data dari form. Method= metode yng digunakan untuk pengiriman data yang dituliskan pemakai aplikasi ke server.

diem
Télécharger la présentation

BEKERJA DENGAN FORM

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. BEKERJA DENGAN FORM Lisda Juliana P.,Ssi.

  2. FORM Sintax : <form name=“ " method=“ " action=“ "> Name= nama form Action= lokasi dari script yang akan memproses data dari form. Method= metode yng digunakan untuk pengiriman data yang dituliskan pemakai aplikasi ke server .

  3. Langkah-langkahnya: • Buat form.html <html> <head><title>:::Form Registrasi:::</title> </head> <body> <form name="Form" method="post" action="proses.php“> Sehinggahasilnya :

  4. 2. Buat file form.php Dengan cara setiap nama control di form.html harus sama dengan proses.php Contoh type chexbox Di form.html // cara 1 Education : <input type="checkbox" name="SD" value="SD -">SD <input type="checkbox" Name="SLTA" Value="SLTA -">SLTA

  5. <input type="checkbox" Name="SMA" Value="SMA -">SMA <input type="checkbox" Name="Akademik" Value="Akademik -">AKADEMIK <input type="checkbox" Name="Strata" Value="Strata -">STRATA-1 <input type="checkbox" Name="Sarjana" Value="Sarjana">PASKA SARJANA </td>

  6. Maka difile proses.php dibuat : <?php $sd=$_POST["SD"]; $SLTP=$_POST["SLTP"]; $SMA=$_POST["SMA"]; $Akademik=$_POST["Akademik"]; $Sarjana=$_POST["Sarjana"];

  7. //menampilkan variabel Echo “<b>Education:</b>”; <b>echo$sd;&nbsp;echo$SLTP;&nbsp; echo$SMA;&nbsp;echo$Akademik;&nbsp; echo$Sarjana;</b> ?>

  8. Di form.html//Cara 2 dgn menggunakan array <form NAME="form1" METHOD="post “ ACTION="PROSES.PHP"> <p ALIGN="LEFT">Pendidikan</p> <input TYPE="checkbox" NAME="pendidikan[]" VALUE="SD-"> SD <input TYPE="checkbox" NAME="pendidikan[]" VALUE="SMP-"> SLTP <input TYPE="checkbox" NAME="pendidikan[]" VALUE="SLTA-"> SLTA <input TYPE="checkbox" NAME="pendidikan[]" VALUE="SARJANA“>SARJANA

  9. Maka difile proses.php dibuat : //menampilkan variabel checkbox echo "<H2>Education:</H2>"; if ( !empty($_POST[pendidikan])) foreach ($_POST[pendidikan] as $value ) { print"$value\n"; }

  10. Type data option buton : Contoh : di form.html // cara 1 Jenis Kelamin : <input type="radio" name="Jkel" value="Pria">Pria <input type="radio" name="Jkel" value="Wanita“> Nb : type option button hanya boleh memilih satu saja maka nama controlnya sama

  11. Di proses.php $Jkel=$_POST["Jkel"]; //untuk memanggilnya: <b>Jenis Kelamin</b> echo$Jkel;

  12. //Cara 2 dgn menggunakan array Pada form.html <p>Jenis kelamin :</p> <input type="radio" name="jenkel[]" value="Pria" id="jenkel_0">Pria <br> <input type="radio" name="jenkel[]" value="Wanita" id="jenkel_1">Wanita

  13. Pada proses.php /*menampilkan variabel option button */ echo "<H2>Jenis Kelamin:</H2>"; if ( !empty($_POST[jenkel])) foreach ($_POST[jenkel] as $nilai ) { print"$nilai\n"; } Untuk type data combobox lihat Check.html Proses.php

  14. Untuk type password Pass.html Login.php

More Related