nama file : input_bayar_spp.php
<?php
mysql_connect("localhost","root","root");
mysql_select_db("sisfokol");
?>
<form name="form1" method="post" action="simpan_bayar_spp.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">PEMBAYARAN SPP</div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="40">No.Transaksi </td>
<td>:
<input name="no_trans" type="text" id="no_trans"></td>
</tr>
</tr>
<tr bgcolor="#FFFFFF">
<td height="40">Id. SPP</td>
<td>:
<select name="id_spp" id="id_spp">
<option>--Pilih id_spp--</option>
<?php
//mengambil id_spp yang ada tabel SPP dalam database
$id_spp = mysql_query("SELECT * FROM spp ORDER BY id_spp");
while($p=mysql_fetch_array($id_spp)){
echo "<option value=\"$p[id_spp]\">$p[id_spp]</option>\n";
}
?>
</select>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="40">NIS</td>
<td>:
<select name="nis" id="nis">
<option>--Pilih NIS--</option>
<?php
//mengambil nis yang ada tabel siswa dalam database
$nis = mysql_query("SELECT * FROM siswa ORDER BY nis");
while($p=mysql_fetch_array($nis)){
echo "<option value=\"$p[nis]\">$p[nis]</option>\n";
}
?>
</select>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="40">Tanggal Bayar</td>
<td>:
<input name="tgl_bayar" type="date" id="tgl_bayar">( yyyy-mm-dd )</td>
</tr>
</tr>
<tr bgcolor="#FFFFFF">
<td height="40">Id Bendahara</td>
<td>:
<select name="id_bendahara" id="id_bendahara">
<option>--Pilih id_bendahara--</option>
<?php
//mengambil id_bendahara yang ada tabel bendahara dalam database
$id_bendahara = mysql_query("SELECT * FROM bendahara ORDER BY id_bendahara");
while($p=mysql_fetch_array($id_bendahara)){
echo "<option value=\"$p[id_bendahara]\">$p[id_bendahara]</option>\n";
}
?>
</select>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td> </td>
<td height="50"><input type="submit" name="Submit" value="Simpan"></td>
</tr>
</table>
</form>
-----------------------
nama file : Simpan_bayar_spp.php
<?php
mysql_connect("localhost","root","root");
mysql_select_db("sisfokol");
$simpan="INSERT INTO bayar SET
no_trans='$_POST[no_trans]',
id_spp='$_POST[id_spp]',
nis='$_POST[nis]',
tgl_bayar='$_POST[tgl_bayar]',
id_bendahara='$_POST[id_bendahara]'";
mysql_query($simpan);
echo "data berhasil disimpan ";
?>