mas ellyx saya ingin memasukkan data dari tabel 1 ke yang lain, dengan menggunakan chekbox, seperti multi delete, yang masuk tu bukan nip tapi kata "Array" mas tolong pencerahannya.....
ini tampilan datanya
<form name="form1" method="post" action="pilih_kandidat.php">
<table width="1002" border="10" align="center" >
<tr>
<td><p align="center" class="style21"><strong>.::</strong> <strong><span class="style13">DATA KARYAWAN</span></strong> <strong>::.</strong></span></p>
<table width="978" border="1" align="center" bordercolor="#0033FF" class="style22" >
<tr bgcolor="#666666" class="style4">
<td width="43" ><div align="center" class="style18" >Pilih</div></td>
<td width="115" ><div align="center" class="style18" >Nip</div></td>
<td width="152" ><div align="center" class="style18" >Nama</div></td>
<td width="192" ><div align="center" class="style18" >Alamat</div></td>
<td width="77" ><div align="center" class="style18" >JK</div></td>
<td width="145" ><div align="center" class="style18" >Jabatan</div></td>
<td width="129" ><div align="center" class="style18" >Devisi</div></td>
<td width="70" ><div align="center" class="style18" >Gol</div></td>
</tr>
<?php
$koneksi=mysql_connect("localhost", "root", "")
or die ("Gagal konek server".mysql_error());
mysql_select_db("spk",$koneksi)
or die ("Database gagal dibuka".mysql_error());
$hal = $_GET[hal];
if(!isset($_GET['hal'])){
$page = 1;
} else {
$page = $_GET['hal'];
}
$max_results = 10;
$from = (($page * $max_results) - $max_results);
$no=1;
$sql = "SELECT karyawan.nip,karyawan.nama,karyawan.alamat,karyawan.jk,jabatan.jabat,jabatan.devisi,jabatan.golongan
FROM karyawan JOIN jabatan ON karyawan.nip=jabatan.nip ORDER BY karyawan.nip asc LIMIT $from, $max_results ";
$qry = mysql_query($sql, $koneksi)
or die ("Query Gagal ".mysql_error());
while($data=mysql_fetch_array($qry)){
?>
<tr>
<td align="center"><input type="checkbox" name="chk[]" id="chk" value="<?=$data['nip'];?>"/></td>
<td><div align="left" class="style38 style10"><?php echo $data['nip']; ?></div></td>
<td><div align="center" class="style24"><?php echo $data['nama']; ?></div></td>
<td><div align="center" class="style24"><?php echo $data['alamat']; ?></div></td>
<td><div align="center" class="style24"><?php echo $data['jk']; ?></div></td>
<td><div align="center" class="style24"><?php echo $data['jabat']; ?></div></td>
<td><div align="center" class="style24"><?php echo $data['devisi']; ?></div></td>
<td><div align="center" class="style24"><?php echo $data['golongan']; ?></div></td>
</tr>
<?php $no=$no+1;} ?>
</table>
<input type="submit" name="submit" value="Pilih !!" id="submit">
<div align="center" class="style18">
<?php
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM
karyawan"),0);
$total_pages = ceil($total_results / $max_results);
if($hal > 1){
$prev = ($page - 1);
echo "<a style='text-decoration:none' class='style18' href=$_SERVER[PHP_SELF]?hal=$prev> <-Prev </a> ";
}
for($i = 1; $i <= $total_pages; $i++){
if(($hal) == $i){
echo "$i ";
} else {
echo "<a style='text-decoration:none' class='style5' href=$_SERVER[PHP_SELF]?hal=$i>$i</a> ";
}
}
if($hal < $total_pages){
$next = ($page + 1);
echo "<a style='text-decoration:none' class='style18' href=$_SERVER[PHP_SELF]?hal=$next>Next-></a>";
}
echo "</center>";
?>
</span></div></td>
</tr>
</table>
</form>
dan ini proses insert data ke tabel lain
<?php
include "config.php";
$id = $_POST [chk];
$banyaknya = count($id);
if($_POST['submit'])
{
for ($i=0; $i<$banyaknya; $i++)
{
$sql = "insert into kandidat (nip) value ('$id')";
$trus = mysql_query($sql);
}
if ($trus)
{
print "Record berhasil diInsert<br>";
print "<a href=data_kandidat.php>Klik disini untuk kembali</a>";
}
}
?>