Pages

October 24, 2013

Membuat Input & Simpan Data Siswa

nama file  :  Input_siswa.php


 <form name="form1" method="post" action="simpan_input_siswa.php">
  <tab
  le 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>
    <tr bgcolor="#FFFFFF">
      <td height="40">Nama </td>
      <td>:
      <input name="nama" type="text" id="nama"></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td height="40">kelas</td>
      <td>:
      <input name="kelas" type="text" id="kelas"></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td height="40">No.absen</td>
      <td>:
      <input name="no_absen" type="text" id="no_absen"></td>
    </tr>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td height="40">Jurusan </td>
      <td>:
      <input name="jurusan" type="text" id="jurusan"></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td>&nbsp;</td>
      <td height="50"><input type="submit" name="Submit" value="Simpan"></td>
    </tr>
  </table>
</form>

------------------------------------------------

Nama File  :  Simpan_input_siswa.php


<?php
mysql_connect("localhost","root","root");
mysql_select_db("sisfokol");


$simpan="INSERT INTO siswa SET
        nis='$_POST[nis]',
        nama='$_POST[nama]',
        kelas='$_POST[kelas]',
        no_absen='$_POST[no_absen]',
        jurusan='$_POST[jurusan]'";

mysql_query($simpan);

 echo "data berhasil disimpan ";
 include ("tampil_siswa.php");
 echo "<br>";
 echo "<a href=input_siswa.php>back</a>";
?>

Comments
0 Comments

0 komentar:

Post a Comment