<?
session_start();
include "koneksi.php";
$sql=mysql_query("select *from table where id = '$nomor'");
$result=mysql_num_rows($sql);
$data=mysql_fetch_array($sql);
//bentuk form
<form action="location.php" method="POST" enctype="multipart/form-data">
<table width="" border="0" align="center">
<tr>
<td> </td>
<td>NIM</td>
<td>:</td>
<td><input type="text" name="NIMHS" id="NIMHS" value="<?=$data['NIMHS'];?>" readonly="" maxlength="10" size="10"></td>
</tr>
<tr>
<td> </td>
<td>Nama </td>
<td>:</td>
<td><input type="text" name="NMMHS" id="NMMHS"value="<?=$data['NMMHS'];?>"></td>
</tr>
<?php
$status = 1;
$allow = 0;
?>
<input type="checkbox" name="status" value="1" <?php if($status == 1){echo 'checked="checked"';}?>/>
<input type="checkbox" name="allow" value="1" <?php if($allow == 1){echo 'checked="checked"';}?>/>
kalau pada input yang lain tinggal tambahkan attbibute value, pada checkbok dan radio button ditambahkan attribute checked EDIT KRS
<?
session_start();
include "config/koneksi.php";
$NIMHS=$_SESSION['NIMHS'];
$query="SELECT * from mhs inner join prodi on mhs.KDPRODI=prodi.KDPRODI where NIMHS='".$_SESSION['NIMHS']."'";
$result=mysql_query($query);
$data=mysql_fetch_array($result);
$bln_sekarang=date("m");
if($bln_sekarang >05 and $bln_sekarang<=12){
$thn_sekarang .="2";
$sem="Gasal";
}else{
$thn_sekarang .="1";
$sem="Genap";
}
?>
<form name="editkrs" method="POST" action="index1.php?hal=editkrs">
<?
echo"<table width=\"500\" cellspacing=5 border=\"0\"><tr><td rowspan=\"5\" valign=\"top\" align=\"justify\">
<tr>
<td>Nama</td><td>: $data[NMMHS]</td>";
echo "<td>NIM</td><td>: $data[NIMHS]</td></tr>";
$tahun=date("Y");
$th1=$tahun+1;
echo"<tr><td>Semester</td><td>: $data[KDSEMES]/ $sem </td>
<td>Tahun akademik</td><td>:$tahun/$th1</td></tr>";
echo "<tr><td>Program Studi</td><td>: $data[PRODI]</td>";
$dosen=mysql_query("select * from mhs inner join dosen on mhs.NIDN=dosen.NIDN where NIMHS='$_SESSION[NIMHS]'");
while ($dos=mysql_fetch_array($dosen)){
$dosennya=$dos['NMDOS'];
echo "<td>Dosen Wali</td><td> : $dosennya </td></tr>";
}
$ip = mysql_query("select * from nilai WHERE NIMHS = '$_SESSION[NIMHS]'");
while($l = mysql_fetch_array($ip)){
$ipnya = $l['IPS'];
if($ipnya>=3){
$sks_dptdiambil="24 sks";
}
elseif($ipnya>=2.5 and $ipnya<3){
$sks_dptdiambil="21 sks";
}
elseif($ipnya>=2 and $ipnya<2.5){
$sks_dptdiambil="18 sks";
}
elseif($ipnya>=1.5 and $ipnya<2){
$sks_dptdiambil="15 sks";
}
else{
$sks_dptdiambil="12 sks";
}
echo "<tr>";
echo "<td >Ip Sebelumnya</td><td>: $ipnya</td>";
echo "<td >Jumlah SKS Y.A.D</td><td>: $sks_dptdiambil";
echo "</td></tr></table>";
}
?>
<p><form name="formkrs" method="POST" action="index1.php?hal=inputkrs">
<table border=1 width="96%" style="border-collapse:collapse" bordercolor="#999999">
<tr><td><b>Kode</b></td>
<td><b>Nama Mata Kuliah</b></td><td><b>HARI</b></td>
<td align="center"><b>JAM</b></td>
<td align="center"><b>SKS</b></td>
<td align="center"><b>NIDN</b></td>
<td align="center"><b>SEMESTER</b></td>
<td align="center"><b>RUANG</b></td>
<!--<td align="center"><b>PRODI</b></td>-->
<td align="center"><b>Ambil</b></td></tr>
<?php
$was = mysql_query("SELECT * FROM mhs WHERE KDPRODI = '$_SESSION[NIMHS]'");
while($pada = mysql_fetch_array($was)){
$PRODI_MHS=$_SESSION['KDPRODI'];
}
$bln_sekarang=date("m");
$operator = '!=';
if($bln_sekarang < 6){ //genap
$operator = '=';
}
$qkrs=mysql_query ("select * from makul inner join jadwal1 on jadwal1.KDMKM=makul.KDMKM where makul.SEMES % 2 $operator 0 and makul.KDPRODI = '$PRODI_MHS' order by makul.SEMES asc");
while($k=mysql_fetch_array($qkrs)){
$displayarts .= " ";
$kode[]=$k['KDMKM'];
$nama[]=$k['NAKMK'];
$hari[]=$k['HARI'];
$jam[]=$k['JAM'];
$nidn[]=$k['NIDN'];
$sks[] = $k['SKSMK'];
$semester[]=$k['SEMES'];
$ruang[]=$k['KDRUANG'];
}
for($i=0;$i<count($kode);$i++){
echo '<tr><td id="k1'.$i.'">'.$kode[$i].'</td>';
echo '<td id="k2'.$i.'">'.$nama[$i].'</td>';
echo '<td id="k3'.$i.'" align="center">'.$hari[$i].'</td>';
echo '<td id="k4'.$i.'">'.$jam[$i].'</td>';
echo '<td align="center" id="k5'.$i.'">'.$sks[$i].'</td>';
echo '<td align="center" id="k6'.$i.'">'.$nidn[$i].'</td>';
echo '<td align="center" id="k7'.$i.'">'.$semester[$i].'</td>';
echo '<td align="center" id="k8'.$i.'">'.$ruang[$i].'</td>';
$status = 1;
$allow = 0;
echo '<td><input type="checkbox" name="mk[]" onclick="hitungtotal()" value="$kode[$i]" if($status ==1) id="mk'.$i.'" checked="checked"></td>';
}
?>
<tr><td colspan=8>JUMLAH YANG DIAMBIL</td><td align="center">
<span id=jsks></span></td></tr>
</table>
<br/>
<input name="kirim" type="submit" value="EDIT KRS">
</form>
</body>
</html>
mLah ke check semua mas