I'm have problems with post data using looping for, when I click the button it doesn't post the data it's said, the index not work properly
for($i=1; $i<=$jumlahpertemuan; $i++){
?>
<tr>
<td><?php echo $i; ?></td>
<td><input readonly type="hidden" name="pertemuan" value="<?php echo "Pertemuan ke-".$i; ?>" /><?php echo "Pertemuan ke-".$i; ?></td>
<td>
<?php
$querypresensi=mysql_query("SELECT * FROM tb_presensipeserta WHERE id='".$i."'");
$resultpresensi=mysql_fetch_array($querypresensi);
if (!$resultpresensi){
?>
<input type="submit" name="hadir" value="hadir" onclick="" />
<input type="submit" name="ijin" value="ijin" />
<input type="submit" name="alfa" value="alfa" /></td>
<td width="30%" align="center"><input type="text" name="tglpertemuan" value="<?php echo "date".$i?>"></td>
</tr>
<?php
}
else {
echo $resultpresensi['Keterangan'];
?>
<td width="30%" align="center"><?php echo $resultpresensi['Date'];?></td>
</tr>
<?php
}
}
What are you trying to achieve here?
You have a MySQL query inside a loop which is really a bad idea.
Anyway, where is the rest of the code?? Where is jumlahpertemuan
defined? Where do you read the data you submit?