1. koneksi.php
<?php
$host='localhost';
$user='root';
$pass='';
$db='kas_kelas';
mysql_connect($host,$user,$pass) or die ("Tidak dapat terkoneksi " . mysql_error());
mysql_select_db($db) or die ("Database tidak ditemukan " . mysql_error());
?>
2. Imput_siswa.php
<form name="form1" method="POST" action="simpan_siswa.php">
<table width="400" border="0" align="center" cellpadding="1" cellspacing="1"
bordercolor="#00FF00" bgcolor="#33CC00">
<tr bgcolor="#CCFFCC">
<td height="50" colspan="2"><div align="center">INPUT DATA SISWA </div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="40">Nis </td>
<td>:
<input name="nis" type="text" id="nis"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="40">Nama </td>
<td>:
<input name="nama" type="text" id="nama"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="40">Jenis Kelamin </td>
<td>:<input type="radio" name="jkel" value="L" checked> Laki-Laki
<input type="radio" name="jkel" value="P"> Perempuan<br>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="40">Telp. </td>
<td>:
<input name="telp" type="text" id="telp"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="40">Alamat</td>
<td>:
<input name="almt" type="text" id="almt"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="40">Saldo</td>
<td>:
<input name="saldo" type="text" id="saldo"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td> </td>
<td height="50"><input type="submit" name="Submit" value="Simpan">
<input type="reset" name="reset" value="Batal"></td>
</tr>
</table>
</form>
3. simpan_siswa.php
<?php
include ("koneksi.php");
$nis=$_POST['nis'];
$nama=$_POST['nama'];
$jkel=$_POST['jkel'];
$telp=$_POST['telp'];
$almt=$_POST['almt'];
$saldo=$_POST['saldo'];
$simpan="insert into siswa values('$nis','$nama','$jkel','$telp','$almt',$saldo)";
mysql_query($simpan);
echo "data berhasil disimpan ";
//include ("tampil_siswa.php");
//echo "<br>";
//echo "<a href=input_siswa.php>back</a>";
?>
<?php
$host='localhost';
$user='root';
$pass='';
$db='kas_kelas';
mysql_connect($host,$user,$pass) or die ("Tidak dapat terkoneksi " . mysql_error());
mysql_select_db($db) or die ("Database tidak ditemukan " . mysql_error());
?>
2. Imput_siswa.php
<form name="form1" method="POST" action="simpan_siswa.php">
<table width="400" border="0" align="center" cellpadding="1" cellspacing="1"
bordercolor="#00FF00" bgcolor="#33CC00">
<tr bgcolor="#CCFFCC">
<td height="50" colspan="2"><div align="center">INPUT DATA SISWA </div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="40">Nis </td>
<td>:
<input name="nis" type="text" id="nis"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="40">Nama </td>
<td>:
<input name="nama" type="text" id="nama"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="40">Jenis Kelamin </td>
<td>:<input type="radio" name="jkel" value="L" checked> Laki-Laki
<input type="radio" name="jkel" value="P"> Perempuan<br>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="40">Telp. </td>
<td>:
<input name="telp" type="text" id="telp"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="40">Alamat</td>
<td>:
<input name="almt" type="text" id="almt"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="40">Saldo</td>
<td>:
<input name="saldo" type="text" id="saldo"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td> </td>
<td height="50"><input type="submit" name="Submit" value="Simpan">
<input type="reset" name="reset" value="Batal"></td>
</tr>
</table>
</form>
3. simpan_siswa.php
<?php
include ("koneksi.php");
$nis=$_POST['nis'];
$nama=$_POST['nama'];
$jkel=$_POST['jkel'];
$telp=$_POST['telp'];
$almt=$_POST['almt'];
$saldo=$_POST['saldo'];
$simpan="insert into siswa values('$nis','$nama','$jkel','$telp','$almt',$saldo)";
mysql_query($simpan);
echo "data berhasil disimpan ";
//include ("tampil_siswa.php");
//echo "<br>";
//echo "<a href=input_siswa.php>back</a>";
?>
Komentar
Posting Komentar