<?php
$result = mysql_query("select * from product");
$jsArray = "var prdName = new Array();\n";
echo '<select name="prdId" onchange="changeValue(this.value)">';
echo '<option>-------</option>';
while ($row = mysql_fetch_array($result)) {
echo '<option value="' . $row['product_id'] . '">' . $row['product_id'] . '</option>';
$jsArray .= "prdName['" . $row['product_id'] . "'] = {name:'" . addslashes($row['product_name']) . "',desc:'".addslashes($row['product_desc'])."'};\n";
}
echo '</select>';
?>
</select>
<input type="text" name="prod_name" id="prd_name"/>
<input type="text" name="prod_desc" id="prd_desc"/>
<script type="text/javascript">
<?php echo $jsArray; ?>
function changeValue(id){
document.getElementById('prd_name').value = prdName[id].name;
document.getElementById('prd_desc').value = prdName[id].desc;
};
</script>
<?
include "../konek.php";
include "session.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>Halaman admin</title>
<link rel="stylesheet" href="../styles/layout.css" type="text/css" />
<style type="text/css">
<!--
.style1 {font-weight: bold}
-->
</style>
</head>
<body>
<!--#############################################################-->
<? include "header_admin.php" ?>
<!--#############################################################-->
<? include "sidekiri.php" ?>
<?php
$siswa->Export = @$_GET["export"]; // Get export parameter
$sExport = $siswa->Export; // Get export parameter, used in header
$sExportFile = $siswa->TableVar; // Get export file, used in header
//$siswa=
$sExportFile1=pendaftar;
?>
<?php
if ($siswa->Export == "excel") {
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename=' . $sExportFile1 .'.xls');
}
if ($siswa->Export == "word") {
header('Content-Type: application/vnd.ms-word');
header('Content-Disposition: attachment; filename=' . $sExportFile1 .'.doc');
}
?>
<?php if ($siswa->Export == "") { ?>
<table>
<tr><td align="center" valign="middle"><a href="tampil_pendaftar2.php?export=excel">Export Data Murid ke Mcr.Excel</a></td>
<td><a href="tampil_pendaftar2.php?export=excel"><img src="images/xl.png" width="30" height="35" border="0"/></a></td>
<td width="10%"></td>
<td><a href="tampil_pendaftar2.php?export=word">Export Data Murid ke Mcr.Word</a></td>
<td><a href="tampil_pendaftar2.php?export=word"><img src="images/word.png" width="30" height="35" border="0"/></a></td>
</tr>
</table>
<?php } ?>
<table width="65%" style="font-size:10px; color:#000000;">
<tr>
<td>No</td>
<td>Nama</td>
<td>T.Lahir</td>
<td>Tgl Lahir</td>
<td>JK</td>
<td>Agama</td>
<td>Alamat</td>
<td>Telfon</td>
<td>Email</td>
<td>Action</td>
</tr>
<?
include "../konek.php";
$no=1;
$query="select * from daftar_siswa order by id";
$sql=mysql_query($query);
while ($row=mysql_fetch_array($sql)) {
$id=stripslashes($row['id']);
$nama=stripslashes($row['nama']);
$t_lahir=stripslashes($row['tempat_lahir']);
$tgllahir=stripslashes($row['tanggal_lahir']);
$jk=($row==0) ? "Laki-Laki" : "Perempuan" ;
$agama=stripslashes($row['agama']);
$telp=stripslashes($row['telp']);
$alamat=stripslashes($row['alamat']);
$email=stripslashes($row['email']);
$warna=($no%2==1)?"#F9F9F9":"#FFF0F0";
?>
<tr bgcolor="<?=$warna?>">
<td><?=$no?></td>
<td><?=$nama?></td>
<td><?=$t_lahir?></td>
<td><?=$tgllahir?></td>
<td><?=$jk?></td>
<td><?=$agama?></td>
<td><?=$alamat?></td>
<td><?=$telp?></td>
<td><?=$email?></td>
<td><a href="delete_pendaftar.php?id=<?=$id?>">Delete</a> </td>
</tr>
<? $no++; } ?>
</table>
</div>
<div style="clear:both"> <? include '../footer.php' ; ?></div>
</body>
</html>
-- Database: `ok`
--
-- --------------------------------------------------------
--
-- Table structure for table `banksoalkepribadian`
--
CREATE TABLE IF NOT EXISTS `banksoalkepribadian` (
`soal_id` int(5) NOT NULL AUTO_INCREMENT,
`bagian` int(1) NOT NULL,
`soal` varchar(100) NOT NULL,
`ya` char(1) NOT NULL,
`tidak` char(1) NOT NULL,
PRIMARY KEY (`soal_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
--
-- Dumping data for table `banksoalkepribadian`
--
INSERT INTO `banksoalkepribadian` VALUES
(1, 1, 'Saya berusaha mengembangkan bakat-bakat yang lemah melalui latihan', 'a', 'p'),
(2, 1, 'Saya cenderung untuk tidak menyapa orang lain', 'i', 'g'),
(3, 1, 'Saya sering murung tanpa ada alasan yang jelas', 's', 'f'),
(4, 1, 'Saya merasa bahwa saya murid paling pintar didalam kelompok belajar', 'g', 'i');
<?php
include "koneksi.php";
$soal = mysql_query("SELECT * FROM banksoalkepribadian where bagian = '1'");
$no = 1;
while($s = mysql_fetch_array($soal)){
echo "<li><b>".$s['soal']."</b><br>\n";
echo "<input type=radio name=soal[".$s['soal_id']."] value='".$s['ya']."'>YA<br>\n";
echo "<input type=radio name=soal[".$s['soal_id']."] value='".$s['tidak']."'>TIDAK<br>\n";
$no++;
}
$jumlahsoal = $no - 1;
echo "<input type=hidden name=jumlahsoal value=$jumlahsoal>";
?>