際際滷

際際滷Share a Scribd company logo
<html> <head> <title>Halaman input data siswa baru</title> </head> <body> <h1>Data Siswa</h1> <FORM ACTION= &quot;inputdata.php&quot; METHOD=&quot;post&quot;> Nomor induk : <BR> <INPUT TYPE= &quot;text&quot; NAME= &quot;noinduknya&quot;><BR> Nama : <BR> <INPUT TYPE= &quot;text&quot; NAME=&quot;namanya&quot;><BR> Alamat : <BR> <INPUT TYPE= &quot;text&quot; NAME=&quot;alamatnya&quot;><BR> <INPUT TYPE=&quot;submit&quot; VALUE=&quot;Input&quot;> <INPUT TYPE=&quot;reset&quot; VALUE=&quot;Cancel&quot;> </FORM> </BODY> </HTML>
<html> <head><title>Latihan mengambil dan menampilkan hasil query</title> </head> <body> <?php $host = 'localhost'; $user = 'root'; $pass = ''; $hasil = mysql_connect ($host, $user, $pass) or die (&quot;koneksi gagal&quot;); $Namadb='sekolah'; $db=mysql_select_db($Namadb); if (isset ($_POST [&quot;noinduknya&quot;])==TRUE && isset ($_POST [&quot;namanya&quot;])==TRUE && isset ($_POST [&quot;alamatnya&quot;])==TRUE) {   $query = &quot;INSERT INTO datasiswa (no_induk, nama_siswa, alamat_siswa) VALUES ('&quot;.$_POST[&quot;noinduknya&quot;].&quot;', '&quot;.$_POST[&quot;namanya&quot;].&quot;','&quot;.$_POST[&quot;alamatnya&quot;].&quot;')&quot;; $hasil=mysql_query($query); } else { echo &quot;<h1>penambahan data gagal</h1>&quot;; }
$query=&quot;SELECT*FROM datasiswa&quot;; $hasil=mysql_query($query); echo &quot;<HR>&quot;; while($rec=mysql_fetch_row($hasil)) { echo $rec[0].&quot; &quot;; echo $rec[1].&quot; &quot;; echo $rec[2]; echo &quot;<BR>&quot;; echo &quot;<HR>&quot;; } ?> <FORM ACTION=&quot;input.php&quot;> <INPUT TYPE=&quot;submit&quot; VALUE =&quot;Ke Halaman Input&quot;> </FORM> </BODY> </HTML>

More Related Content

Presentation1

  • 1. <html> <head> <title>Halaman input data siswa baru</title> </head> <body> <h1>Data Siswa</h1> <FORM ACTION= &quot;inputdata.php&quot; METHOD=&quot;post&quot;> Nomor induk : <BR> <INPUT TYPE= &quot;text&quot; NAME= &quot;noinduknya&quot;><BR> Nama : <BR> <INPUT TYPE= &quot;text&quot; NAME=&quot;namanya&quot;><BR> Alamat : <BR> <INPUT TYPE= &quot;text&quot; NAME=&quot;alamatnya&quot;><BR> <INPUT TYPE=&quot;submit&quot; VALUE=&quot;Input&quot;> <INPUT TYPE=&quot;reset&quot; VALUE=&quot;Cancel&quot;> </FORM> </BODY> </HTML>
  • 2. <html> <head><title>Latihan mengambil dan menampilkan hasil query</title> </head> <body> <?php $host = 'localhost'; $user = 'root'; $pass = ''; $hasil = mysql_connect ($host, $user, $pass) or die (&quot;koneksi gagal&quot;); $Namadb='sekolah'; $db=mysql_select_db($Namadb); if (isset ($_POST [&quot;noinduknya&quot;])==TRUE && isset ($_POST [&quot;namanya&quot;])==TRUE && isset ($_POST [&quot;alamatnya&quot;])==TRUE) { $query = &quot;INSERT INTO datasiswa (no_induk, nama_siswa, alamat_siswa) VALUES ('&quot;.$_POST[&quot;noinduknya&quot;].&quot;', '&quot;.$_POST[&quot;namanya&quot;].&quot;','&quot;.$_POST[&quot;alamatnya&quot;].&quot;')&quot;; $hasil=mysql_query($query); } else { echo &quot;<h1>penambahan data gagal</h1>&quot;; }
  • 3. $query=&quot;SELECT*FROM datasiswa&quot;; $hasil=mysql_query($query); echo &quot;<HR>&quot;; while($rec=mysql_fetch_row($hasil)) { echo $rec[0].&quot; &quot;; echo $rec[1].&quot; &quot;; echo $rec[2]; echo &quot;<BR>&quot;; echo &quot;<HR>&quot;; } ?> <FORM ACTION=&quot;input.php&quot;> <INPUT TYPE=&quot;submit&quot; VALUE =&quot;Ke Halaman Input&quot;> </FORM> </BODY> </HTML>