mohon bantuannya mas saya sangat bingung pada di bagian script data_siswa.php adalah bagian dari input siswa disini masalah yang tidak mengerti kali pada penggunaan tanggal yg sy gunakan format date sehingga pada script p_i_siswa.php pada tanggal nya masih error jadi begitu data diinput dan dismpan tidak mau menyimpan dan berhasil karena, pada p_i_siswa.php dibagian elseif ($tanggal_lahir=="") {
echo"<script>alert('Maaf tanggal lahir belum terisi dengan benar',document.location.href='javascript:history.back(0)')</script>";
masih error dan saya tidak mengerti untuk menambahkan coding selanjutnya dari $tanggal_lahir = "$tgl_lahir, $bln_lahir, $thn_lahir" ..... mohon bantuannya ya mas informasi anda sangat saya butuhkan.... mohon dibalas dengan cepat ya mas...HAnya Allah SWT yg membalas kebaikan anda trims
data_siswa.php
<?
session_start();
$id = $_COOKIE['id'];
$username = $_COOKIE['username'];
$hak_akses=$_COOKIE['hak_akses'];
$last_login = $_COOKIE['last_login'];
if(!isset($_COOKIE['username'])) {
header("location:index.php");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>SMP SWASTA MUHAMMADIYAH 03 MEDAN</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #858585;
}
a:link {
font-family: Arial, Helvetica, sans-serif;
color: #A2B1C3;
text-decoration: none;
font-size: 11px;
}
a:hover {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #A2B1C3;
text-decoration: none;
font-weight: bold;
}
a:visited {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #A2B1C3;
text-decoration: none;
}
a:active {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #A2B1C3;
text-decoration: none;
}
.style6 {color: #FFFFFF}
-->
</style>
<link href="cpanel_css.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style8 {color: #FFFFFF; font-size: 10px; }
.style9 {font-size: 11px}
.style10 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style11 {font-size: 10px}
.style7 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; }
.style12 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #FFFFFF; }
.style13 {font-size: 12px}
-->
</style>
</head>
<body>
<div align="center">
<table background="../images/bawah.gif" width="800" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="800" height="138" valign="top"><table background="../images/admin_01.gif" width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="9" height="94"> </td>
<td width="773"> </td>
<td width="18"> </td>
</tr>
<tr>
<td height="28"></td>
<td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="773" height="28" align="center"><? include"link.php" ?></td>
</tr>
</table> </td>
<td></td>
</tr>
<tr>
<td height="16"></td>
<td></td>
<td></td>
</tr>
</table></td>
</tr>
<tr>
<td height="387" valign="top"><table background="../../ta_agus1/images/back.gif"width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="800" height="387" valign="top"><table width="705" border="0" align="center">
<tr>
<td> </td>
</tr>
<tr>
<td><div align="center" class="font1 style6 style13"><strong>DATA SISWA </strong></div></td>
</tr>
<tr>
<td><hr /></td>
</tr>
<tr>
<td><form id="form1" name="form1" method="post" action="p_i_siswa.php" enctype="multipart/form-data">
<table width="714" border="0" align="center">
<tr>
<td colspan="3"><table width="762" border="0" align="center">
<tr>
<td width="101" class="font1"><div align="left" class="style8 style9">NIS</div></td>
<td width="10" class="font1"><div align="left" class="style6 style11">:</div></td>
<td width="295" class="font1"><div align="left" class="style6 style11">
<input name="nis" type="text" class="style10" id="nis" tabindex="1" size="25" />
</div></td>
<td width="18" class="font1"><div align="left"><span class="style6"><span class="style9"><span class="style11"><span class="style9"><span class="style11"><span class="style11"></span></span></span></span></span></span></div></td>
<td width="90" class="font1"><div align="left" class="style6 style11">PEKERJAAN</div></td>
<td width="11" class="font1"><div align="left" class="style6 style11">:</div></td>
<td width="207" class="font1"><div align="left" class="style6 style11">
<input name="pekerjaan" type="text" class="style10" id="pekerjaan" tabindex="12" size="25" />
</div></td>
</tr>
<tr>
<td class="font1"><div align="left" class="style6 style11">NAMA SISWA </div></td>
<td class="font1"><div align="left" class="style6 style11">:</div></td>
<td class="font1"><div align="left" class="style6 style11">
<input name="nama_siswa" type="text" class="style10" id="nama_siswa" tabindex="2" size="25" />
</div></td>
<td class="font1"><div align="left"><span class="style6"><span class="style9"><span class="style11"><span class="style9"><span class="style11"><span class="style11"></span></span></span></span></span></span></div></td>
<td class="font1"><div align="left" class="style6 style11">NAMA WALI SISWA </div></td>
<td class="font1"><div align="left" class="style6 style11">:</div></td>
<td class="font1"><div align="left" class="style6 style11">
<input name="nm_wali" type="text" class="style10" id="nm_wali" tabindex="13" size="25" />
</div></td>
</tr>
<tr>
<td class="font1"><div align="left" class="style6 style11">TEMPAT LAHIR </div></td>
<td class="font1"><div align="left" class="style6 style11">:</div></td>
<td class="font1"><div align="left" class="style6 style11">
<input name="tpt_lahir" type="text" class="style10" id="tpt_lahir" tabindex="3" size="25" />
</div></td>
<td class="font1"><div align="left"><span class="style6"><span class="style9"><span class="style11"><span class="style9"><span class="style11"><span class="style11"></span></span></span></span></span></span></div></td>
<td class="font1"><div align="left" class="style6 style11">ALAMAT WALI </div></td>
<td class="font1"><div align="left" class="style6 style11">:</div></td>
<td class="font1"><div align="left" class="style6 style11">
<input name="alamat_wali" type="text" class="style10" id="alamat_wali" tabindex="14" size="25" />
</div></td>
</tr>
<tr>
<td class="font1"><div align="left" class="style6 style11">TANGGAL LAHIR </div></td>
<td class="font1"><div align="left" class="style6 style11">:</div></td>
<td class="font1"><div align="left" class="font1 style11">
<select name="tgl_lahir" class="style10" id="tgl_lahir" tabindex="1" size="1" >
<option selected="selected"> [PILIH]</option>
<?php
for ($i=1;$i<=31;$i++)
{
echo "<option value=".$i.">".$i."</option>";
}
?>
</select>
<select name="bln_lahir" class="style10" id="bln_lahir" tabindex="1" size="1" >
<option selected="selected">[PILIH]</option>
<?php
$bulan=array("","Januari","Pebruari","Maret","April","Mei","Juni","Juli","Agustus","September", "Oktober","November","Desember");
for ($i=1;$i<=12;$i++)
{
echo "<option value=".$i.">".$bulan[$i]."</option>";
}
?>
</select>
<select name="thn_lahir" type="text" class="style10" id="thn_lahir" size="1" />
<option selected="selected">[PILIH]</option>
<?php
for ($i=1985;$i<=2002;$i++)
{
echo "<option value=".$i.">".$i."</option>";
}
?>
</select>
</div></td>
<td class="font1"><div align="left"><span class="style6"><span class="style9"><span class="style11"><span class="style9"><span class="style11"><span class="style11"></span></span></span></span></span></span></div></td>
<td class="font1"><div align="left" class="style6 style11">TAHUN MASUK </div></td>
<td class="font1"><div align="left" class="style6 style11">:</div></td>
<td class="font1"><div align="left" class="style6 style11">
<input name="thn_masuk" type="text" class="style10" id="thn_masuk" tabindex="15" size="25" />
</div></td>
</tr>
<tr>
<td class="font1"><div align="left" class="style6 style11">JENIS KELAMIN </div></td>
<td class="font1"><div align="left" class="style6 style11">:</div></td>
<td class="font1"><div align="left" class="style6 style11">
<select name="jen_kel" class="style10" id="jen_kel" tabindex="7" >
<option selected="selected">[ PILIH ]</option>
<option>Pria</option>
<option>Wanita</option>
</select>
</div></td>
<td class="font1"><div align="left"><span class="style6"><span class="style9"><span class="style11"><span class="style9"><span class="style11"><span class="style11"></span></span></span></span></span></span></div></td>
<td class="font1"><div align="left" class="style6 style11">KELAS</div></td>
<td class="font1"><div align="left" class="style6 style11">:</div></td>
<td class="font1"><div align="left" class="style6 style11">
<select name="kd_kelas" class="style10" id="kd_kelas" tabindex="16" >
<option selected="selected">[ PILIH ]</option>
<?php include"../koneksi.php";
$query=mysql_query("select * from tb_kelas");
while($baris=mysql_fetch_array($query))
{
?>
<option value="<? echo"$baris[kd_kelas]" ?>"><? echo"$baris[nm_kelas]" ?>
<? } ?>
</option>
</select>
</div></td>
</tr>
<tr>
<td class="font1"><div align="left" class="style6 style11">AGAMA</div></td>
<td class="font1"><div align="left" class="style6 style11">:</div></td>
<td class="font1"><div align="left" class="style6 style11">
<select name="agama" class="style10" id="agama" tabindex="8" >
<option selected="selected">[ PILIH ]</option>
<option>Islam</option>
<option>Kristen Katolik</option>
<option>Kristen Protestan</option>
<option>Hindu</option>
<option>Budha</option>
</select>
</div></td>
<td class="font1"><div align="left"><span class="style6"><span class="style9"><span class="style11"><span class="style9"><span class="style11"><span class="style11"></span></span></span></span></span></span></div></td>
<td class="font1"> </td>
<td class="font1"> </td>
<td class="font1"> </td>
</tr>
<tr>
<td class="font1"><div align="left" class="style6 style11">ALAMAT </div></td>
<td class="font1"><div align="left" class="style6 style11">:</div></td>
<td class="font1"><div align="left" class="style6 style11">
<input name="alamat" type="text" class="style10" id="alamat" tabindex="9" size="25" />
</div></td>
<td class="font1"><div align="left"><span class="style6"><span class="style9"><span class="style11"><span class="style9"><span class="style11"><span class="style11"></span></span></span></span></span></span></div></td>
<td class="font1"><div align="left" class="style6 style11">PASSWORD</div></td>
<td class="font1"><div align="left" class="style6 style11">:</div></td>
<td class="font1"><div align="left" class="style6 style11">
<input name="password" type="password" class="style10" id="password" tabindex="18" size="25" />
</div></td>
</tr>
<tr>
<td class="font1"><div align="left" class="style6 style11">NAMA ORANG TUA </div></td>
<td class="font1"><div align="left" class="style6 style11">:</div></td>
<td class="font1"><div align="left" class="style6 style11">
<input name="nm_ortu" type="text" class="style10" id="nm_ortu" tabindex="10" size="25" />
</div></td>
<td class="font1"><div align="left"><span class="style6"><span class="style9"><span class="style11"><span class="style9"><span class="style11"><span class="style11"></span></span></span></span></span></span></div></td>
<td class="font1"><div align="left" class="style6 style11">FOTO</div></td>
<td class="font1"><div align="left" class="style6 style11">:</div></td>
<td class="font1"><div align="left" class="style6 style11">
<input name="foto" type="file" class="font1" id="foto" />
</div></td>
</tr>
<tr>
<td class="font1"><div align="left" class="style6 style11">ALAMAT ORG TUA </div></td>
<td class="font1"><div align="left" class="style6 style11">:</div></td>
<td class="font1"><div align="left" class="style6 style11">
<input name="alamat_ortu" type="text" class="style10" id="alamat_ortu" tabindex="11" size="25" />
</div></td>
<td class="font1"><div align="left"><span class="style6"><span class="style9"><span class="style11"><span class="style9"><span class="style11"><span class="style11"></span></span></span></span></span></span></div></td>
<td class="font1"><div align="left"><span class="style6"><span class="style9"><span class="style11"><span class="style9"><span class="style11"><span class="style11"></span></span></span></span></span></span></div></td>
<td class="font1"><div align="left"><span class="style6"><span class="style9"><span class="style11"><span class="style9"><span class="style11"><span class="style11"></span></span></span></span></span></span></div></td>
<td class="font1"><div align="left"><span class="style6"><span class="style9"><span class="style11"><span class="style9"><span class="style11"><span class="style11"></span></span></span></span></span></span></div></td>
</tr>
<tr>
<td colspan="7" class="font1"> </td>
</tr>
<tr>
<td colspan="7" class="font1"><div align="center" class="style6 style11">
<input name="Submit" type="submit" class="tombol_sibmit" tabindex="20" value="Simpan" />
<input name="Submit2" type="reset" class="tombol_sibmit" tabindex="21" value="Reset" />
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="3"><hr /></td>
</tr>
<tr>
<td width="131"> </td>
<td width="264"> </td>
<td width="284"> </td>
</tr>
</table>
</form> </td>
</tr>
<tr>
<td><table width="765" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
<tr>
<td width="85" height="20" bgcolor="#DDDDDD" class="style7"><div align="center">NIS</div></td>
<td width="235" height="20" bgcolor="#DDDDDD" class="style7">NAMA SISWA </td>
<td width="258" height="20" bgcolor="#DDDDDD" class="style7">TPT/TGL LAHIR </td>
<td height="20" colspan="3" bgcolor="#DDDDDD" class="style7"><div align="center">ACTION</div></td>
</tr>
<?php
include "../koneksi.php";
$query = mysql_query("select * from tb_siswa");
while($baris=mysql_fetch_array($query))
{
?>
<tr>
<td height="20" class="style7"><div align="center" class="style6"><? echo"$baris[nis]" ?></div></td>
<td height="20" class="style7"><span class="style6"><? echo"$baris[nama_siswa]" ?></span></td>
<td height="20" class="style12"><? echo"$baris[tpt_lahir]" ?>, <? echo"$baris[tanggal_lahir]" ?> </td>
<td width="57" height="20" class="style7"><div align="center" class="style6"><? echo"<a href=\"tampil_siswa.php?nis=$baris[nis]\">Tampil</a>" ?></div></td>
<td width="52" class="style7"><div align="center" class="style6"><? echo"<a href=\"edit_siswa.php?nis=$baris[nis]\">Ubah</a>" ?></div></td>
<td width="52" class="style7"><div align="center" class="style6"><a href="hapus_siswa.php"><? echo"<a href=\"p_hapus_siswa.php?nis=$baris[nis]\">Hapus</a>" ?></a></div></td>
</tr>
<? } ?>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="100" valign="top"><table background="../images/bawah1.gif"width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="800" height="100"> </td>
</tr>
</table></td>
</tr>
</table>
</div>
</body>
</html>
p_i_siswa.php
<?
include"koneksi.php";
$nis=$_POST['nis'];
$nama_siswa=$_POST['nama_siswa'];
$tpt_lahir=$_POST['tpt_lahir'];
$tanggal_lahir = $_POST['tgl_lahir']."-".$_POST['bln_lahir']."-".$_POST['thn_lahir'];
$jen_kel=$_POST['jen_kel'];
$agama=$_POST['agama'];
$alamat=$_POST['alamat'];
$nm_ortu=$_POST['nm_ortu'];
$alamat_ortu=$_POST['alamat_ortu'];
$pekerjaan=$_POST['pekerjaan'];
$nm_wali=$_POST['nm_wali'];
$alamat_wali=$_POST['alamat_wali'];
$thn_masuk=$_POST['thn_masuk'];
$kd_kelas=$_POST['kd_kelas'];
$password=$_POST['password'];
$foto=$_FILES['foto']['name'];
if($nis == $baris[nis]){
echo"<script>alert('Maaf NIS Siswa dengan No : $nis sudah ada',document.location.href='javascript:history.back(0)')</script>";
}
elseif ($nis == ""){
echo"<script>alert('Maaf anda belum mengisi NIS Siswa',document.location.href='javascript:history.back(0)')</script>";
}
elseif ($nama_siswa == ""){
echo"<script>alert('Maaf anda belum mengisi Nama Siswa',document.location.href='javascript:history.back(0)')</script>";
}
elseif ($tpt_lahir == ""){
echo"<script>alert('Maaf anda belum mengisi Tempat Lahir',document.location.href='javascript:history.back(0)')</script>";
}
elseif ($tanggal_lahir=="") {
echo"<script>alert('Maaf tanggal lahir belum terisi dengan benar',document.location.href='javascript:history.back(0)')</script>";
}
elseif ($agama == "[ PILIH ]"){
echo"<script>alert('Maaf anda belum memilih Agama',document.location.href='javascript:history.back(0)')</script>";
}
elseif ($alamat == ""){
echo"<script>alert('Maaf anda belum mengisi Alamat Mahasiswa',document.location.href='javascript:history.back(0)')</script>";
}
elseif ($nm_ortu == ""){
echo"<script>alert('Maaf anda belum mengisi Nama Orangtua',document.location.href='javascript:history.back(0)')</script>";
}
elseif ($alamat_ortu == ""){
echo"<script>alert('Maaf anda belum mengisi Alamat Orangtua',document.location.href='javascript:history.back(0)')</script>";
}
elseif ($pekerjaan == ""){
echo"<script>alert('Maaf anda belum mengisi Pekerjaan Orangtua',document.location.href='javascript:history.back(0)')</script>";
}
elseif ($kd_kelas == "[ PILIH ]"){
echo"<script>alert('Maaf anda belum memilih Kelas',document.location.href='javascript:history.back(0)')</script>";
}
elseif ($password == ""){
echo"<script>alert('Maaf anda belum mengisi Password Siswa',document.location.href='javascript:history.back(0)')</script>";
}
elseif($foto == "none"){
$foto="0";
mysql_query("insert into tb_siswa(nis,nama_siswa,tpt_lahir,tanggal_lahir,jen_kel,agama,alamat,nm_ortu,alamat_ortu,pekerjaan,nm_wali,alamat_wali,thn_masuk,kd_kelas,password,foto)"." values('$nis','$nama_siswa','$tpt_lahir','$tanggal_lahir','$jen_kel','$agama','$alamat','$nm_ortu','$alamat_ortu','$pekerjaan','$nm_wali','$alamat_wali','$thn_masuk','$kd_kelas','$password','$foto')");
echo"<script>alert('Data Siswa berhasil disimpan ke database, Tidak Ada File Yang di Upload ',document.location.href='data_siswa.php')</script>";
}
else
{
$folderupload='../foto/';
$uploadfile = $folderupload . basename($_FILES['foto']['name']);
move_uploaded_file($_FILES['foto']['tmp_name'],$uploadfile);
mysql_query("insert into tb_siswa(nis,nama_siswa,tpt_lahir,tanggal_lahir,jen_kel,agama,alamat,nm_ortu,alamat_ortu,pekerjaan,nm_wali,alamat_wali,thn_masuk,kd_kelas,password,foto)"." values('$nis','$nama_siswa','$tpt_lahir','$tanggal_lahir','$jen_kel','$agama','$alamat','$nm_ortu','$alamat_ortu','$pekerjaan','$nm_wali','$alamat_wali','$thn_masuk','$kd_kelas','$password','$foto')");
echo"<script>alert('Data Siswa berhasil disimpan ke database, Upload Dile Sukses',document.location.href='data_siswa.php')</script>";
}
?>