Saya mempunyai sebuah halaman web dengan scrip sbb
<html>
<head>
<title>Untitled Document</title>
<style type="text/css">
<!--
.style2 {font-size: 12px}
-->
</style>
</head>
<body>
 <table width="450" border="0" align="center" cellpadding="0" cellspacing="0">
   <tr>
     <td height="27" colspan="5"><img src="images/atas%20siswa.gif" width="430" height="26"></td>
   </tr>
   <tr>
     <td height="27" colspan="5" align="center"><br><div class="assalam">
       <h1>DAFTAR SISWA </h1>
     </div></td>
   </tr>
   <tr>
     <td height="27" colspan="5"><hr></td>
   </tr>
   <tr>
     <td height="27" colspan="5"><div align="center">

       <table width="98%"  border="0" cellspacing="0" cellpadding="0"><form action="?act=cari_siswa" name="form1" method="post">
         <tr>
           <td width="41%"><div align="right">Cari Nama Siswa: &nbsp;&nbsp;</div></td>
           <td width="37%"><input name="nama" type="text" id="nama" size="20"></td>
           <td width="22%"><input  type="submit" name="cari_siswa" value="Cari"></td>
         </tr></form>
       </table>
     </div></td>
   </tr>
   <tr>
     <td colspan="5"><hr></td>
   </tr>
    <?php
   include_once('koneksi/konek.php');
   $dataPerPage = 15;
if(isset($_GET['page']))
{
   $noPage = $_GET['page'];
}
	else 
	$noPage = 1;
	$offset = ($noPage - 1) * $dataPerPage;

   $sql_siswa = "SELECT tabel_siswa.id,tabel_siswa.nis,tabel_siswa.nama,tabel_siswa.tempat_lahir,tabel_siswa.tanggal_lahir,tabel_siswa.alamat,tabel_siswa.foto,tabel_jurusan.jurusan FROM tabel_siswa INNER JOIN tabel_jurusan ON tabel_siswa.id_jurusan=tabel_jurusan.id_jurusan where tabel_jurusan.status='Aktif' AND tabel_siswa.status='Aktif' ORDER BY tabel_jurusan.id_jurusan ASC limit $dataPerPage";
   $qr_siswa = mysql_query($sql_siswa,$connect) or die ("Salah query".mysql_error());
   while($hs_siswa=mysql_fetch_array($qr_siswa))
   {
    
    $id=$hs_siswa[0];
	//$gambar = $_REQUEST['gambar'];
	$gambar=$hs_siswa[6];

 
  ?>
   <tr>
   
     <td width="150" rowspan="6"><span class="style2">
       <?php
	  
	  if (empty($gambar))
	  {
		  echo "<img src='admin/images/siswa/noimage.jpg' width=150 height=150>";
	  }
	  else
	  {
  	  	  echo "<img src='admin/images/siswa/$gambar' width=150 height=150>";
	  }
	  ?>
     </span></td>
     <td height="6" colspan="4"></td>
   </tr>
   <tr>
     <td width="8">&nbsp;</td>
     <td width="80" height="20"><font size="2" face="Tahoma">NIS</font></td>
     <td width="16"><div align="left">:</div></td>
     <td width="184"><font size="2" face="Tahoma"><?php echo "$hs_siswa[1] "; ?></font></td>
   </tr>
   <tr>
     <td>&nbsp;</td>
     <td height="21"><font size="2" face="Tahoma">Nama</font></td>
     <td><div align="left">:</div></td>
     <td><font size="2" face="Tahoma"><?php echo "$hs_siswa[2] "; ?></font></td>
   </tr>
   <tr>
     <td>&nbsp;</td>
     <td height="24"><font size="2" face="Tahoma">T T L </font></td>
     <td><div align="left">:</div></td>
     <td><font size="2" face="Tahoma"><?php 
	 $tgllahir=$hs_siswa[4];
	$tgllhr = substr($tgllahir,8,2);
	$blnlhr = substr($tgllahir,5,2);
	$thnlhr = substr($tgllahir,0,4);
	$tgllahir = $tgllhr.'-'.$blnlhr.'-'.$thnlhr;	
	 echo "$hs_siswa[3], $tgllahir "; ?></font></td>
   </tr>
   <tr>
     <td>&nbsp;</td>
     <td height="24"><font size="2" face="Tahoma">Alamat</font></td>
     <td><div align="left">:</div></td>
     <td><font size="2" face="Tahoma"><?php echo "$hs_siswa[5] "; ?></font></td>
   </tr>
   <tr>
     <td>&nbsp;</td>
     <td height="24"><font size="2" face="Tahoma">Jurusan</font></td>
     <td><div align="left">:</div></td>
     <td><font size="2" face="Tahoma"><?php echo "$hs_siswa[7] "; ?></font></td>
   </tr>
   <tr>
     <td colspan="5"><hr></td>
   
   </tr>
   <tr>
     <td colspan="5"></td>
   </tr>
<?php } ?>
 </table>
 
<?php
	$query   = "SELECT COUNT(*) AS jumData FROM tabel_siswa INNER JOIN tabel_jurusan ON tabel_siswa.id_jurusan=tabel_jurusan.id_jurusan where tabel_jurusan.status='Aktif' AND tabel_siswa.status='Aktif'";
	$hasil  = mysql_query($query);
	$data     = mysql_fetch_array($hasil);

	$jumData = $data['jumData'];
	$jumPage = ceil($jumData/$dataPerPage);
	echo "<table border=0 align='center'>";
	echo "<tr>";
	echo "<td align='center'>";
	if ($noPage > 1) echo  "<a href='".$_SERVER['PHP_SELF']."?page=".($noPage-1)."'>&lt;&lt; Prev  </a>";
	for($page = 1; $page <= $jumPage; $page++)
	{
         if ((($page >= $noPage - 3) && ($page <= $noPage + 3)) || ($page == 1) || ($page == $jumPage))
         {
		 $showPage = $page;
            if (($showPage == 1) && ($page != 2))  echo " ... ";
            if (($showPage != ($jumPage - 1)) && ($page == $jumPage))  echo " ... ";
          
			if ($page == $noPage) 
			{
			echo "[ ";
			echo "<b>"  .$page.  "</b>";
			echo " ]";
			}
			else 
			{
			echo "[ ";
			echo "<a href='".$_SERVER['PHP_SELF']."?page=".$page."'>" .$page. "</a>";
           echo " ]";
			}
			//$showPage = $page;
         }
}

if ($noPage < $jumPage) echo "<a href='".$_SERVER['PHP_SELF']."?page=".($noPage+1)."'>  Next &gt;&gt;</a>";
  	echo "</td>";
  	echo "</tr>";
  	echo "<tr>";
  	echo "<td align='center'>";
	echo "Jumlah Data = $jumData";
  	echo "</td>";
  	echo "</tr>";
  	echo "</table>";
?>

</body>
</html>
Tapi ketika saya ingin mencari Nama Siswa tidak malah mencari atau menuju halaman cari malah pergi kehalaman index. Mohon petunjuknya suhu?

Lihat semua 1 jawaban

Silahkan login untuk menjawab!
Sya mempunyai masalah saat ingin membuat Paging pada Tabel Database yang berelasi. Dimana Pada Data No. 2 dan 3 juga keluar pada Page 2. Lebih jelasnya Silahkan Lihat Screen Shotnya di Bawah Ini:
http://perosot.in/images/list1.jpg
http://perosot.in/images/list2.jpg

Source:
<?php

//Koneksi Ke Database
include "config.php";

if(isset($_POST['submit'])){
	
	$domain		=	$_POST['domain'];
	$username	=	$_POST['username'];
	$password	=	$_POST['password'];
	$skin		=	$_POST['skin'];
	$email		=	$_POST['email'];
	$ftpdir		=	$_POST['ftpdir'];
		
	$query	=	mysql_query("INSERT INTO cpanel (domain,username,password,skin,email) VALUES ('$domain','$username','$password','$skin','$email')");
	
	$sql = "select max(id_cpanel) as last_id from cpanel limit 1";
	$hasil = mysql_query($sql);
	$row = mysql_fetch_array($hasil);
	$lastId = $row['last_id'];
	$sql	=	mysql_query("INSERT INTO directory (id_cpanel,ftpdir) VALUES ('$lastId','$ftpdir')");
	
	if($query){
		header ("Location:cpanel.php");
	}else{
		echo"Failed Add cPanel Account";	
	}
	
}

?>

<form action="" method="post">
<strong>Add cPanel Account</strong>
<table width="200" border="1">
  <tr>
    <td>Domain</td>
    <td><input type='text' name='domain'></td>
  </tr>
  <tr>
    <td>Username</td>
    <td><input type='text' name='username'></td>
  </tr>
  <tr>
    <td>Password</td>
    <td><input type='password' name='password'></td>
  </tr>
  <tr>
    <td>Skin</td>
    <td><input type='text' name='skin' value='x3'></td>
  </tr>
  <tr>
    <td>Email</td>
    <td><input type='text' name='email'></td>
  </tr>
  <tr>
    <td>Directory</td>
    <td><input type='text' name='ftpdir'></td>
  </tr>
  <tr><td colspan='2' align='center'><input type='submit' name='submit' value='Submit'></td></tr>
</table>
</form>
<hr />

<style rel='stylesheet' type='text/css'>
th{
background:#1d87eb;
text-align: center;
font-type: bold;
border: 0px red;
}

tr{
background:#e6e6e6;
border: 0px;
}
</style>

<strong>List cPanel Account</strong>
<table>
<tr><th>No</th><th>Domain</th><th>Username</th><th>Password</th><th>Skin</th><th>Email</th><th>Directory</th><th>Option</th><th>Backup</th><th>DIR</th></tr>
<?php

$batas=5;
$halaman=$_GET['halaman'];
if(empty($halaman))
{
	$posisi=0;
	$halaman=1;
}
else
{
	$posisi = ($halaman-1);
}

$query = mysql_query("SELECT * FROM cpanel t1, directory t2  WHERE t1.id_cpanel=t2.id_cpanel limit $posisi,$batas");

$no=$posisi+1;
while($data = mysql_fetch_array($query)){

echo"

<td>$no</td>
<td>$data[domain]</td>
<td>$data[username]</td>
<td>$data[password]</td>
<td>$data[skin]</td>
<td>$data[email]</td>
<td>$data[ftpdir]</td>
<td>
<INPUT TYPE='BUTTON' VALUE='Edit' ONCLICK=window.location.href='cpaneledit.php?id_cpanel=$data[id_cpanel]'> <INPUT TYPE='BUTTON' VALUE='Del' ONCLICK=window.location.href='cpaneldel.php?id_cpanel=$data[id_cpanel]'>
</td>
<td><INPUT TYPE='BUTTON' VALUE='Backup' ONCLICK=window.location.href='backup.php?id_cpanel=$data[id_cpanel]'></td>
<td><INPUT TYPE='BUTTON' VALUE='Create' ONCLICK=window.location.href='ftpaccess.php?id_cpanel=$data[id_cpanel]'></td></tr>
";	
$no++;
}
echo "</table><br>";	
$file="paging.php";

$tampil2="select * from cpanel t1, directory t2";
$hasil2=mysql_query($tampil2);
$jmlhalaman=ceil($hasil2/$batas);


//link ke halaman sebelumnya (previous)
if($halaman > 1)
{
	$previous=$halaman-1;
	echo "<A HREF=$file?halaman=1><< First</A> | 
        <A HREF=$file?halaman=$previous>< Previous</A> | ";
}
else
{ 
	echo "<< First | < Previous | ";
}

$angka=($halaman > 3 ? " ... " : " ");
for($i=$halaman-2;$i<$halaman;$i++)
{
  if ($i < 1) 
      continue;
  $angka .= "<a href=$file?halaman=$i>$i</A> ";
}

$angka .= " <b>$halaman</b> ";
for($i=$halaman+1;$i<($halaman+3);$i++)
{
  if ($i > $jmlhalaman) 
      break;
  $angka .= "<a href=$file?halaman=$i>$i</A> ";
}

$angka .= ($halaman+2<$jmlhalaman ? " ...  
          <a href=$file?halaman=$jmlhalaman>$jmlhalaman</A> " : " ");

echo "$angka";

//link kehalaman berikutnya (Next)
if($halaman < $jmlhalaman)
{
	$next=$halaman+1;
	echo " | <A HREF=$file?halaman=$next>Next ></A> | 
  <A HREF=$file?halaman=$jmlhalaman>Last >></A> ";
}
else
{ 
	echo " | Next > | Last >>";
}

?>

Mohon Bantuannya :)

Lihat semua 5 jawaban

Silahkan login untuk menjawab!
mas, saya bikin input data yang pakai validasi, pesan errornya jalan, tapi kenpa tidak bisa tersimpan ya datanya?
<?php
session_start();
if(isset($_SESSION['error'])){
	$error=$_SESSION['error'];
	$_POST=$_SESSION['post'];
	unset($_SESSION['error']);
	unset($_SESSION['post']);
	}
include "../connect.php";
	$hasil = mysql_query("SELECT max(id_low) as maxID FROM lowongan");
	$data = mysql_fetch_array($hasil);
	$idMax=$data['maxID'];
	// mengambil angka atau bilangan dalam kode anggota terbesar,
	// dengan cara mengambil substring mulai dari karakter ke-0 diambil 4 karakter
	// misal '00001', akan diambil '0001'
	// setelah substring bilangan diambil lantas dicasting menjadi integer
	$noUrut = (int) substr($idMax, 0, 4);
	// bilangan yang diambil ini ditambah 1 untuk menentukan nomor urut berikutnya
	$noUrut++;
	// membentuk kode anggota baru
	// perintah sprintf("%04s", $noUrut); digunakan untuk memformat string sebanyak 4 karakter
	// misal sprintf("%04s", 12); maka akan dihasilkan '0012'
	// atau misal sprintf("%04s", 1); maka akan dihasilkan string '0001'
	$newID = sprintf("%04s", $noUrut);
	// kode anggota yang baru di atas nanti akan ditampilkan dalam komponen text box
?>

<!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=utf-8" />
<title>Situs Lowongan Kerja Universitas Kristen Duta Wacana</title>
<link href="../adminstyle.css" rel="stylesheet" type="text/css"/>
</head>

<body>
<div id="wrapper">
	<div id="header-wrapper"><a href="../index.php"><img src="../images/silokerukdw.jpg"/></a>
		<!--<div id="header">
    		<div id="logo">
    		</div>
    	</div>-->
    	</div>
    </div>
    <!-- end #header -->
	    <div id="navigation">
			<ul>
			<a href="hal_admin.php">ADMIN </a>
			<a href="perusahaan.php">PERUSAHAAN</a>
            <li id="current"><a href="lowongan.php">LOWONGAN</a></li>
            <a href="kriteria.php">KRITERIA</a>
			<a href="logout.php">LOGOUT</a>
            </ul>
        </div>
        <!-- end #navigation -->
        <div id="page">
            <div id="content">
				<p>
                <?php
				if(empty($_SESSION[user])and empty($_SESSION[pass])){
					echo "<center>Untuk mengakses data, anda harus LOGIN dulu</center><br>";
					echo "<center><a href=login.php><b>LOGIN</b></a></center>";
				}
				//kalau sudah login benar
				else{
					$nama_bulan=array(1=>"Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember");
					echo "<h2>Tambah Data Lowongan :</h2>
					<form method=post action=input_lowongan.php>
					<table>
						<tr>";
						?>
                        <!-- NGISI SENDIRI KODE OTOMATIS INCREMENT -->
						<td class=noborder>ID Low</td>
						<td class=noborder>:</td>
						<td class=noborder><input type="text" name="id_low" maxlength="4" value="<?php echo $newID; ?>" size=10 disabled/>
                        <input name="id" type="hidden" value="<?php echo $newID; ?>" /></td>
						</tr>
						<?php
						echo "<tr>
						<td class=noborder>Posisi</td>
						<td class=noborder>:</td>";
						?>
                        <td class=noborder><input name="lowongan" type="text" size="50" maxlength="100" value="<?php echo isset($_POST['lowongan']) ? $_POST['lowongan'] : '';?>" /></td>
                        </tr>
                        <tr>
                        <td class="noborder" colspan="2"></td>
                        <td class="noborder"><div style="color:#F00"><?php echo isset($error['lowongan'])?$error['lowongan']:''; ?></div></td>
                        </tr>
                        <?php
                        echo "<tr>
						<td class=noborder>Perusahaan</td>
						<td class=noborder>:</td>
						<td class=noborder><select name=perusahaan>";
						//nampilin combobox dari field nama perusahaan
						$tampil=mysql_query("select * from perusahaan order by perusahaan");
						echo "<option value=belum pilih selected=selected>-pilih-</option>";
						while($r=mysql_fetch_array($tampil)){
							echo"<option value=$r[id_per]>$r[perusahaan]</option>";
							}
						echo "</select></td>
						</tr>";
						?>
						<tr>
                        <td class="noborder" colspan="2"></td>
                        <td class="noborder"><div style="color:#F00"><?php echo isset($error['perusahaan'])?$error['perusahaan']:''; ?></div></td>
                        </tr>
						<?php
                        echo "<tr>
						<td class=noborder>Min. IPK</td>
						<td class=noborder>:</td>";
						?>
                        <td class=noborder><input name="min_ipk" type="text" size="4" maxlength="4" value="<?php echo isset($_POST['min_ipk']) ? $_POST['min_ipk'] : '';?>" /></td>
                        </tr>
                        <tr>
                        <td class="noborder" colspan="2"></td>
                        <td class="noborder"><div style="color:#F00"><?php echo isset($error['min_ipk'])?$error['min_ipk']:''; ?></div></td>
                        </tr>
                        <?php						
						echo "<tr>
						<td class=noborder>Min. Usia</td>
						<td class=noborder>:</td>";
						?>
						<td class=noborder><input name="min_usia" type="text" size="2" maxlength="2" value="<?php echo isset($_POST['min_usia']) ? $_POST['min_usia'] : '';?>" /></td>
                        </tr>
                        <tr>
                        <td class="noborder" colspan="2"></td>
                        <td class="noborder"><div style="color:#F00"><?php echo isset($error['min_usia'])?$error['min_usia']:''; ?></div></td>
                        </tr>
						<?php
                        echo "<tr>
						<td class=noborder>Max. Usia</td>
						<td class=noborder>:</td>";
						?>
						<td class=noborder><input name="min_usia" type="text" size="2" maxlength="2" value="<?php echo isset($_POST['max_usia']) ? $_POST['max_usia'] : '';?>" /></td>
                        </tr>
                        <tr>
                        <td class="noborder" colspan="2"></td>
                        <td class="noborder"><div style="color:#F00"><?php echo isset($error['max_usia'])?$error['max_usia']:''; ?></div></td>
                        </tr>
						<?php
						echo "<tr>
						<td class=noborder>Penempatan</td>
						<td class=noborder>:</td>
						<td class=noborder><select name=penempatan>";
						//nampilin combobox dari field nama perusahaan
						$tampil=mysql_query("select * from penempatan order by id_tempat");
						echo "<option value=belum pilih selected=selected>-pilih-</option>";
						while($r=mysql_fetch_array($tampil)){
							echo"<option value=$r[id_tempat]>$r[penempatan]</option>";
							}
						echo "</select></td></tr>";
						?>
						<tr>
                        <td class="noborder" colspan="2"></td>
                        <td class="noborder"><div style="color:#F00"><?php echo isset($error['penempatan'])?$error['penempatan']:''; ?></div></td>
                        </tr>
						<?php
                        echo "<tr>
						<td class=noborder>Jenjang</td>
						<td class=noborder>:</td>
						<td class=noborder><select name=jenjang>";
						$tampil=mysql_query("select * from jenjang order by id_jenjang");
						echo "<option value=belumpilih selected>-pilih-</option>";
						while($r=mysql_fetch_array($tampil)){
							echo"<option value=$r[id_jenjang]>$r[jenjang]</option>";
							}
						echo "</select></td></tr>";
						?>
						<tr>
                        <td class="noborder" colspan="2"></td>
                        <td class="noborder"><div style="color:#F00"><?php echo isset($error['jenjang'])?$error['jenjang']:''; ?></div></td>
                        </tr>
						<?php
                        echo "
						<tr>
						<td class=noborder>Gender</td>
						<td class=noborder>:</td>
						<td class=noborder>
						<select name=gender>
						<option value=semua>Semua</option>
						<option value=pria>Pria</option>
						<option value=wanita>Wanita</option>
						</select>
						</td>
						</tr>";
						?>
						<tr>
                        <td class="noborder" colspan="2"></td>
                        <td class="noborder"><div style="color:#F00"><?php echo isset($error['gender'])?$error['gender']:''; ?></div></td>
                        </tr>
						<?php
                        echo "
						<tr>
						<td class=noborder>Tgl Expired</td>
						<td class=noborder>:</td>
						<td class=noborder>";
						//TANGGAL
						echo "<select name=tanggal>
						<option value=0 selected>Tgl</option>";
						for($tgl=1;$tgl<=31;$tgl++){
							//hitung panjang karakter tanggal
							$panjang_karakter=strlen($tgl);
							//jika cuma 1 digit, tambah 0 di depannya
							if($panjang_karakter==1)
								$i="0".$tgl;
							else
								$i=$tgl;
							echo "<option value=$i>$i</option>";
							}
						echo "</select>";
						//BULAN
						echo "<select name=bulan>
						<option value=0 selected>Bulan</option>";
						for($bln=1;$bln<=12;$bln++){
							echo "<option value=$bln>$nama_bulan[$bln]</option>";
							}
						echo "</select>";
						//TAHUN
						$thn_skrg=date("Y");
						echo "<select name=tahun>
						<option value=0 selected>Tahun</option>";
						for($thn=2011;$thn<=$thn_skrg;$thn++){
							echo "<option value=$thn>$thn</option>";
							}
						echo "</select>";
						echo "</td>
						</tr>";
						?>
						<tr>
                        <td class="noborder" colspan="2"></td>
                        <td class="noborder"><div style="color:#F00"><?php echo isset($error['tanggal'])?$error['tanggal']:''; ?> - <?php echo isset($error['bulan'])?$error['bulan']:''; ?> - <?php echo isset($error['tahun'])?$error['tahun']:''; ?></div></td>
                        </tr>
						<?php
                        echo "
						<tr>
						<td class=noborder>Keterangan</td>
						<td class=noborder>:</td>
						<td class=noborder><textarea name=keterangan cols=50 rows=4></textarea></td>
						</tr>
						<tr>
						<td class=noborder>Jurusan</td>
						<td class=noborder>:</td>
						<td class=noborder>";
						//nampilin checkbox dari tabel jurusan
						$tampil=mysql_query("select * from jurusan order by id_jur");
						$no=1;
						while($jur=mysql_fetch_array($tampil)){
							echo "<input type='checkbox' value='".$jur['id_jur']."' name='jurusan".$no."'>".$jur['jurusan']."<br>";
							$no++;
							}
							?>
						<input type=hidden name=jumjur value="<?php echo $no-1; ?>">
                        <td class=noborder><font size=-3 color="#FF0000">*)harus diisi</font></td>
						<?php
                        echo "</td>
						</tr>
						<tr>
						<td colspan=3 class=noborder><input type=submit name=submit value=Simpan>
						<a href=lowongan.php><input type=button value=Batal></a></td>
						</tr>
					</table></form>";
				}
				?>
                </p>
				<p>&nbsp;</p>
            </div>
            </div>
            <div id="footer">
            &copy; 2012 Situs Lowongan Kerja UKDW
            </div>
</body>
</html>
<?php
session_start();
include "../connect.php";
if($_POST){
	$id_low = $_POST['id'];
	$lowongan = $_POST['lowongan'];
	$id_per = $_POST['perusahaan'];
	$min_ipk = $_POST['min_ipk'];
	$min_usia = $_POST['min_usia'];
	$max_usia = $_POST['max_usia'];
	$id_tempat = $_POST['penempatan'];
	$id_jenjang = $_POST['jenjang'];
	$gender = $_POST['gender'];
	$keterangan = $_POST['keterangan'];
	$tanggal=$_POST['tanggal'];
	$bulan=$_POST['bulan'];
	$tahun=$_POST['tahun'];
	$jumjur = $_POST['jumjur'];
	
	$polaipk="^[0-4]{1}\.[0-9]{2}$";
	
	$error=array();
	if(empty($lowongan)){
		$error['lowongan']="Posisi lowongan harus diisi";
		}
	if(empty($perusahaan)){
		$error['perusahaan']="Perusahaan harus diisi";
		}
	if(empty($penempatan)){
		$error['penempatan']="Penempatan harus diisi";
		}
	if(empty($jenjang)){
		$error['jenjang']="Jenjang harus diisi";
		}
	if(empty($gender)){
		$error['gender']="Gender harus diisi";
		}
	if(empty($tanggal)){
		$error['tanggal']="Tanggal harus diisi";
		}
	if(empty($bulan)){
		$error['bulan']="Bulan harus diisi";
		}
	if(empty($tahun)){
		$error['tahun']="Tahun harus diisi";
		}
	if(!empty($min_ipk)){
		if(!eregi($polaipk,$min_ipk)){
			$error['min_ipk']="Nilai ipk salah. Contoh 3.00";
			}
		}
	if(!empty($min_usia)){
		if(!is_numeric($min_usia)){
			$error['min_usia']="Nilai minimal usia harus berupa angka";
			}
		}			
	if(!empty($max_usia)){
		if(!is_numeric($max_usia)){
			$error['max_usia']="Nilai maksimal usia harus berupa angka";
			}
		}	
	if(empty($error)){
		mysql_query("insert into lowongan(id_low,lowongan,id_per,min_ipk,min_usia,max_usia,id_tempat,id_jenjang,gender,expired,keterangan) values('$id_low','$lowongan','$id_per','$min_ipk','$min_usia','$max_usia','$id_tempat','$id_jenjang','$gender',('$tahun-$bulan-$tanggal'),'$keterangan')");
		//UNTUK MENAMBAHKAN ID_JUR KE LOWJUR		
		for($i=1;$i<=$jumjur;$i++){
			$jurusan=$_POST['jurusan'.$i];
			if(!empty($jurusan)){
				mysql_query("insert into low_jur(id_low,id_jur) values('$id_low','$jurusan')");
				}
			}
			
		header('location:lowongan.php');
		}			
	else{
		$_SESSION['error']=$error;
		$_SESSION['post']=$_POST;
		header('location:tambah_lowongan.php');
		}
}
?>
               
terimakasih

Lihat semua 2 jawaban

Silahkan login untuk menjawab!
Saat saya mencoba login keluar error seperti ini:
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\index\backup\user\auth.php on line 16
Mungkin Akun Anda Dalam Status Disable Silahkan Login!

Berhubunga saya sudah Pusing dan mencoba sendiri namun belum juga berhasil, jadi saya ingin tahu dimana letak kesalahan saya. Berikut ini Source yang saya buat:

File Login.php
<table width="200" border="1">
<form method="post" action="auth.php">
  <tr>
    <td>Username</td>
    <td><input name="username" type="text"></td>
  </tr>
  <tr>
    <td>Password</td>
    <td><input name="password" type="text"></td>
  </tr>
 <tr><td colspan="2"><input type='submit' value="Login"></td></tr></form>
</table>


File Auth.php
<?php

//Koneksi ke Database
include		"../config/config.php";

//Mengambil data dari Form
$username		=		$_POST['username'];
$password		=		md5($_POST['password']);

//Mencegah SQL Injection
$username		=		mysql_real_escape_string($username);
$password		=		mysql_real_escape_string($password);

$query	="SELECT FROM user WHERE username='$username' and password='$password'";
$result = mysql_query($query);
if(mysql_num_rows($result) !=0){
	
	$num=mysql_fetch_array($query);
	$_SESSION['username'] = $num['username'];
	$_SESSION['password'] = $num['password'];
	$_SESSION['status'] = $num['status'];
	
	if($num['status'] =='Enable'){
		header("Location: home.php");
	}
}else{
	echo"Mungkin Akun Anda Dalam Status Disable";
	echo"<a href='login.php'>Silahkan Login!</a>";
}
?>

Lihat semua 3 jawaban

Silahkan login untuk menjawab!
Bli putu, sya prh denger bhw variabel di address bs jadi adress biasa lewat edit .htaccess, misal:
www.testestes.com/index.php?tahun=2012&nama=Siapa menjadi www.testestes.com/index.php/2012/Siapa..
atau sejenisnya lah.. sya kurang inget..
apa bener bisa ya? suksma bli putu. maaf klo pertanyaannya kurang jelas.

Lihat semua 6 jawaban

Silahkan login untuk menjawab!
mas sya mau nanya,
sya ingin nampilin jumlah data yang L brapa dan TL brapa Perbulan gimana cranya y mas, nanti akan di buatkan persentasenya.

ini scrip formnya:
<?php 
include('koneksi.php');
?>
<html>
<head>
<title>Form Evaluasi Formulir</title>
</head>

<body>
<table width="776" bgcolor="#CCCC99">
<tr>
<td width="305" align="center">
<h1>Form Input</h1>
</td></tr></table>

<table><tr><td>
<?php 
if (!empty($_GET['message']) && $_GET['message'] == 'success') {
	echo '<h3>Berhasil menambah data!</h3>';
}
?>
</td></tr></table>

<form name="input_data" action="insertdataevaluasi.php" method="post">
<table width="776" border="0" cellpadding="5" cellspacing="0" bgcolor="#CCCC99">
    <tbody>
		<tr>
        	<td width="218">Kode Evaluasi</td>
        	<td width="8">:</td>
        	<td width="520"><input type="text" name="kd_evaluasi" maxlength="20" required="required" /></td>
        </tr>
    	<tr>
			<td>Tanggal Evaluasi / Sekarang</td>
			<td>:</td>
			<td>
			<?php
				echo "<select name=tanggal>
						<option value=0>Tanggal</option>";
				for($no=1;$no<=31;$no++)
				{
					echo "<option value=$no>$no</option>";	
				}
				
				echo "</select>";
				
				$nama_bln = array(1=> "Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober",
									  "November","Desember");
				echo "<select name=bulan>
						<option value=0>Bulan</option>";
				for($no=1;$no<=12;$no++)
				{
					echo "<option value=$no>$nama_bln[$no]</option>";	
				}
				echo "</select>";
				
				$thn_skrg = date("Y");
				echo "<select name=tahun>
						<option value=0>Tahun</option>";
				for($no=1989;$no<=$thn_skrg;$no++)
				{
					echo "<option value=$no>$no</option>";	
				}
				
				echo "</select>";
			?>
			</td>
		</tr>
    	
			<td>Formulir Diagnosa</td>
			<td>:</td>
			<td>
			<input type="radio" name="diagnosa" value="L">Lengkap <input type="radio" name="diagnosa" value="TL">Tidak Lengkap 
			</td>
		</tr>
		<tr>
			<td>Formulir Ringkasan Masuk Keluar</td>
			<td>:</td>
			<td>
			<input type="radio" name="ringkasan_msk_klr" value="L">Lengkap <input type="radio" name="ringkasan_msk_klr" value="TL">Tidak Lengkap 
			</td>
		</tr>
        <tr>
			<td>Lembar Pengobatan</td>
			<td>:</td>
			<td>
			<input type="radio" name="lmbr_pengobatan" value="L">Lengkap <input type="radio" name="lmbr_pengobatan" value="TL">Tidak Lengkap 
			</td>
		</tr>
		<tr>
			<td>Formulir Catatan Perkembangan</td>
			<td>:</td>
			<td>
			<input type="radio" name="ctt_perkembangan" value="L">Lengkap <input type="radio" name="ctt_perkembangan" value="TL">Tidak Lengkap 
			</td>
		</tr>
		<tr>
			<td>Formulir Catatan Perawat</td>
			<td>:</td>
			<td>
			<input type="radio" name="ctt_perawat" value="L">Lengkap <input type="radio" name="ctt_perawat" value="TL">Tidak Lengkap 
			</td>
		</tr>
		
		<tr>
			<td>Inform Consent</td>
			<td>:</td>
			<td>
			<input type="radio" name="inform_consent" value="L">Lengkap <input type="radio" name="inform_consent" value="TL">Tidak Lengkap 
			</td>
		</tr>
		<tr>
			<td>Resume Medis</td>
			<td>:</td>
			<td>
			<input type="radio" name="resume_medis" value="L">Lengkap <input type="radio" name="resume_medis" value="TL">Tidak Lengkap 
			</td>
		</tr>
		<tr>
			<td>Resep</td>
			<td>:</td>
			<td>
			<input type="radio" name="resep" value="L">Lengkap <input type="radio" name="resep" value="TL">Tidak Lengkap 
			</td>
		</tr>
		<tr>
		<td>Pilih Data Penyakit</td>
        	<td>:</td>
			<td>
			<select name="kd_penyakit">
			<?php
			// query untuk menampilkan semua penyakit
			$query = "SELECT * FROM penyakit";
			$hasil = mysql_query($query);
			while ($data = mysql_fetch_array($hasil))
			{
			// setiap penyakit yang dibaca dari tabel disisipkan ke tag <option></option>
			echo "<option value='".$data['kd_penyakit']."'>".$data['nm_penyakit']."</option>";
			}
			?>
			</select>
			</td>
		</tr>
        <tr>
		<td>Pilih Dokter</td>
        	<td>:</td>
			<td>
			<select name="kd_dokter">
			<?php
			// query untuk menampilkan semua dokter
			$query = "SELECT * FROM dokter";
			$hasil = mysql_query($query);
			while ($data = mysql_fetch_array($hasil))
			{
			// setiap dokter yang dibaca dari tabel disisipkan ke tag <option></option>
			echo "<option value='".$data['kd_dokter']."'>".$data['nm_dokter']."</option>";
			}
			?>
			</select>
			</td>
		</tr>
    	<tr>
		<td>Pilih Ruangan</td>
        	<td>:</td>
			<td>
			<select name="kd_ruangan">
			<?php
			// query untuk menampilkan semua ruangan
			$query = "SELECT * FROM ruangan";
			$hasil = mysql_query($query);
			while ($data = mysql_fetch_array($hasil))
			{
			// setiap ruangan yang dibaca dari tabel disisipkan ke tag <option></option>
			echo "<option value='".$data['kd_ruangan']."'>".$data['nm_ruangan']."</option>";
			}
			?>
			</select>
			</td>
		</tr>
        <tr>
		<td>Nama Pasien</td>
        	<td>:</td>
			<td>
			<select name="no_rm">
			<?php
			// query untuk menampilkan semua pasien
			$query = "SELECT * FROM pasien";
			$hasil = mysql_query($query);
			while ($data = mysql_fetch_array($hasil))
			{
			// setiap pasien yang dibaca dari tabel disisipkan ke tag <option></option>
			echo "<option value='".$data['no_rm']."'>".$data['nm_pasien']."</option>";
			}
			?>
			</select>
			</td>
		</tr>
		
		<tr>		
        	<td align="right" colspan="3"><input type="submit" name="submit" value="Simpan" /></td>
        </tr>
    </tbody>
</table>
</form>

<a href="viewdataevaluasi.php">Lihat Data</a>
</body>
</html>

ini scrip viewnya :
<?php 
include('koneksi.php');
 $warnagenap = "#CCCCCC" ;
 $warnaganjil = "#FFFFFF" ;
?>

<html>
<head>
<title>Form Evaluasi</title>
<script type="text/javascript">
function cetakhalaman()
{
window.print();
}
</script>
</head>

<body>
<table width="1386" bgcolor="#CCCC99">
<tr>
<td width="305" align="center">
<h1>Data Evaluasi</h1>
</td></tr></table>

<?php 
if (!empty($_GET['message']) && $_GET['message'] == 'success') {
	echo '<h3>Berhasil meng-update data!</h3>';
} else if (!empty($_GET['message']) && $_GET['message'] == 'delete') {
	echo '<h3>Berhasil menghapus data!</h3>';
}
?>

<a href="formevaluasi.php">+ Tambah Data</a>

<table width="1386" border="1" cellpadding="5" cellspacing="0">
	<thead>
    	<tr bgcolor="#CCCC99">
        	<td>No.</td>
			<td>Kode Evaluasi</td>
        	<td>Tanggal Evaluasi</td>        	
			<td>Diagnosa</td>
        	<td>Ringkasan Masuk Keluar</td>
			<td>Catatan Perkembangan</td>
        	<td>Catatan Perawat</td>
			<td>Lembar Pengobatan</td>
			<td>Inform Consent</td>
        	<td>Resume Medis</td>
			<td>Resep</td>
            <td>Penyakit</td>
			<td>Dokter</td>
        	<td>Ruangan</td>
            <td>Pasien</td>
			<td align="center">Action</td> 
    </thead>
    <tbody>
    <?php 
	$query = mysql_query("select * from evaluasi");
	
	$no = 1;
	$counter = 1;
	while ($data = mysql_fetch_array($query)) {
	?>
    <?
    	if ($counter % 2 == 0) $warna = $warnagenap ;
		else $warna = $warnaganjil ;
	?>
    	<tr bgcolor="<? echo $warna;?>">
        	<td><?php echo $no; ?></td>
			<td><?php echo $data['kd_evaluasi']?></td>
        	<td><?php echo $data['tgl_evaluasi']; ?></td>        	
			<td><?php echo $data['diagnosa']; ?></td>
        	<td><?php echo $data['ringkasan_msk_klr']; ?></td> 
			<td><?php echo $data['ctt_perkembangan']; ?></td>
        	<td><?php echo $data['ctt_perawat']; ?></td>
			<td><?php echo $data['lmbr_pengobatan']; ?></td> 
			<td><?php echo $data['inform_consent']; ?></td>
        	<td><?php echo $data['resume_medis']; ?></td>
			<td><?php echo $data['resep']; ?></td>
            <td><?php echo $data['kd_penyakit']; ?></td>
			<td><?php echo $data['kd_dokter']; ?></td>
        	<td><?php echo $data['kd_ruangan']; ?></td> 
            <td><?php echo $data['no_rm']; ?></td>
            <td>
            	<a href="editdataevaluasi.php?id=<?php echo $data['kd_evaluasi']; ?>">Edit</a> || 
                <a href="deletedataevaluasi.php?id=<?php echo $data['kd_evaluasi']; ?>">Hapus</a>
            </td>
        </tr>
    <?php 
		$no++;
		$counter++;
	} 
	?>
    </tbody>
</table>
<table><tr><td>
<input type="button" value="Print" onClick="cetakhalaman()" />
</td></tr></table>
</body>
</html>

kalau ada saran ga' pa juga mas.

Lihat semua 1 jawaban

Silahkan login untuk menjawab!