Simpan tanggal dari j-query g bisa..!

Kang Jambi · Oct 3, 2012
Mas, ane masih newbie nih. Mau nanya, gimana caranya nyimpan data tanggal. Sudah saya cek semua, tapi masih ndak mau mas, mohon petunjuknya.Maksih...:)
<?php
session_start();
include ("header.php");
?>
<link rel="stylesheet" type="text/css" media="all" href="jsdate/jsDatePick_ltr.min.css" />
<script type="text/javascript" src="jsdate/jsDatePick.min.1.3.js"></script>
<script type="text/javascript">
	window.onload = function(){
		new JsDatePick({
			useMode:2,
			target:"tgl_lahir",
			dateFormat:"%Y-%M-%d"
		});
	};
</script>
		
<section id="content">
	<section class="container_12 clearfix">
		<section id="main" class="grid_9 push_3">
			<article id="dashboard">
                           <?php
include "koneksi.php";
include "../configurasi/library.php";
include "../configurasi/fungsi_indotgl.php";
include "../configurasi/fungsi_combobox.php";
include "../configurasi/class_paging.php";
// Bagian Home

  if ($_SESSION['id']=='1'){
  echo "<p>Hai <b>$_SESSION[nama]</b>, Selamat datang di halaman Administrator .<br>
          Silahkan klik menu pilihan yang berada di sebelah kiri untuk mengelola website.</p>";
          ?>
        
  
         <h2>Tambah Pengajar</h2><hr color="#CCCCCC" />
				<table>
<tr><td height="20">
<form method="post" enctype="multipart/form-data" action="simpan_pengajar.php">
<?php
include ("Koneksi.php");
$nip = $_GET['nip'];
$sql = mysql_fetch_array(mysql_query("select * from tabel_guru where nip='$nip'"));
echo "NIP &nbsp;&nbsp;&nbsp;</td><td height='20'>: &nbsp;&nbsp;&nbsp; <input type=text name=nip> <br> </td><tr><td>";
echo "Nama Guru &nbsp;&nbsp;&nbsp;</td><td height='20'>: &nbsp;&nbsp;&nbsp; <input type=text name=nama_guru> <br> </td><tr><td>";
echo "J.Kelamin &nbsp;&nbsp;&nbsp;</td><td height='20'>: &nbsp;&nbsp;&nbsp; 
<select name=j_kelamin>
<option value=Laki-laki>Laki-laki</option>
<option value=Perempuan>Perempuan</option>
</select>


 <br> </td><tr><td>";
echo "T.Lahir &nbsp;&nbsp;&nbsp;</td><td height='20'>: &nbsp;&nbsp;&nbsp; <input type=text name=tempat_lahir> <br> </td><tr><td>";
echo "Tgl.Lahir &nbsp;&nbsp;&nbsp;</td><td height='20'>:&nbsp;&nbsp;&nbsp; <input type=text name=tgl_lahir id=tgl_lahir><br> </td><tr><td> "; 
echo "No.Telp/Hp &nbsp;&nbsp;&nbsp;</td><td height='20'>: &nbsp;&nbsp;&nbsp; <input type=text name=telp><br> </td><tr><td valign='top'>";
echo "Alamat &nbsp;&nbsp;&nbsp;</td><td height='20'>: &nbsp;&nbsp;&nbsp; <textarea name=alamat></textarea><br> </td><tr><td>";
echo "B.Studi &nbsp;&nbsp;&nbsp;</td><td height='20'>: &nbsp;&nbsp;&nbsp; <input type=text name=bidang_studi><br> </td><br><tr><td>&nbsp;</td></tr><tr><td>";
echo "Foto &nbsp;&nbsp;&nbsp;</td><td height='20'>  &nbsp;&nbsp;&nbsp;&nbsp;  <img src='./gambar/1 (14).jpg' width='150' height'200' border='1'> <br> </td><tr><td>";
?>
<br /><br />
<a href="pengajar.php"><input type="button" value="Batal" name="submit" class="button blue" /></a>
<input type="submit" value="Simpan" name="submit" class="button blue" />
</td></tr> 

<tr><td colspan="4"><hr color="#CCCCCC" /><br />* Foto biarkan pengajar sendiri yang mengisikan ketika mendaftar akun.</td></tr>
</form>
</table>
<?php
}
?>
		        </article>
		</section>

<?php
include ("sisi.php");
?>                          

<div>
<?php
//periksa apakah user telah menekan submit, dengan menggunakan parameter setingan keterangan
if (isset($_POST['submit']))
{//1111111111111111111111111
	include "koneksi.php";
	
	
	$nip=$_POST['nip'];
	$nama=$_POST['nama_guru'];
	$j_kelamin=$_POST['j_kelamin'];
	$tempat_lahir=$_POST['tempat_lahir'];
	$tgl_lahir=$_POST['tgl_lahir'];
	$date = date_create($tgl_lahir);
	date_format($date, 'Y-m-d');
	$telp=$_POST['telp'];
	$alamat=$_POST['alamat'];
	$bidang_studi=$_POST['bidang_studi'];

	//periksa jika data yang dimasukan belum lengkap
	if(empty($nip) || empty($nama) || empty($bidang_studi) || empty($j_kelamin)) {
	echo "<script type=text/Javascript>";
	echo "function runOnLoad() {";
	echo "alert('Masih ada data penting yang kosong. Silahkan ulangi..!!!');";
	echo "document.location.href='tambah_pengajar.php';";
	echo "}";
	echo "window.onload = runOnLoad;";
	echo "</script>";
	
	
		
	}else{
	
					// cek keberadaan email dalam database
		$query = "SELECT * FROM tabel_guru WHERE nip = '$nip'";
		$hasil = mysql_query($query);
		$jumNIS  = mysql_num_rows($hasil);
			if ($jumNIS > 0) {
	echo "<script type=text/Javascript>";
	echo "function runOnLoad() {";
	echo "alert('Maaf, NIP ini telah terdaftar. Harap Cek kembali.!!!');";
	echo "document.location.href='tambah_pengajar.php';";
	echo "}";			
	echo "window.onload = runOnLoad;";
	echo "</script>";		
	

			}
			else
			{//4444444444444444444444444
			// perlu dibuat sebarang pengacak
			//$pengacak  = "NDJS3289JSKS190JISJI";

			// mengenkripsi password dengan md5() dan pengacak
			//$password1 = md5($pengacak . md5($password1) . $pengacak);

			//definisikan variabel file dan alamat file
			
				//catat data file yang berhasil di upload
				$upload=mysql_query("INSERT INTO tabel_guru (nip,nama_guru,tempat_lahir,tgl_lahir,telp,gambar,bidang_studi,alamat,j_kelamin) VALUES('$nip','$nama','$tempat_lahir','$date','$telp','','$bidang_studi','$alamat','$j_kelamin')");

				if($upload){
			
	echo "<script type=text/Javascript>";
	echo "function runOnLoad() {";
	echo "alert('NIP telah terdaftar dalam database sistem, silahkan login..!!!');";
	echo "document.location.href='pengajar.php';";
	echo "}";
	echo "window.onload = runOnLoad;";
	echo "</script>";
				//jika berhasil
//				echo "<p>Data Anda berhasil disimpan. Silahkan Login</p>";

				}
				else{
	echo "<script type=text/Javascript>";
	echo "function runOnLoad() {";
	echo "alert('Maaf, proses pendaftaran gagal, Silahkan ulangi..!!!');";
	echo "document.location.href='tambah_pengajar.php';";
	echo "}";
	echo "window.onload = runOnLoad;";
	echo "</script>";
	
		
				
				//echo "gagal simpan data";
				
		}
		

//echo "Password yang dimasukkan tidak sama";
}

}
}
?>
</div>
Silahkan login untuk menjawab!
0
Loading...
Ellyx Christian · Oct 3, 2012 · 0 Suka · 0 Tidak Suka
coba hilangkan bagian
$date = date_create($tgl_lahir);
date_format($date, 'Y-m-d');