i need some help with my code,
When i click to checkbox, i want it post to a file php (check.php) and return data, check php will store data that i click to session array and return 1 if success, 0 if error. In index, it will show text like this: You choosed: A, B, C ...
This is result:
This is my HTML code:
<script language="JavaScript">
function chkallClick(o) {
var form = document.frmForm;
for (var i = 0; i < form.elements.length; i++) {
if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
form.elements[i].checked = document.frmForm.chkall.checked;
}
}
}
</script>
<form method="POST" name="frmForm" id="frmForm" enctype="multipart/form-data">
<table>
<tr>
<th width="2%"><input type="checkbox" name="chkall" onClick="chkallClick(this);"></th>
</tr>
<?php while ($rows = $result->fetch_assoc()) { ?>
<tr>
<th><input type="checkbox" name="chk[]" value="<?php echo $rows['id'];?>"></th>
</tr>
<?php } ?>
</table>
</form>
This is my check.php file
<?php
if(success)
{
$_SESSION['arr']=$_POST['chk'];
echo "1";
}
else
echo "0";
?>
When i click checkbox, it post dynamically to check.php and return data
I used this: Checkbox Data Dynamically Save to Database on Click but not working.
Check.php is my idea, i want to show you my idea in this file, not exacly code.
I try to show you my idea, hope you can understand. Thank you!
