This post explains how to submit Check box values in form. Example mail-box selected mails deletion. I had experimented with javascript support.
In this script Checkbox values store in hidden field name store_del. In demo it was a text field.
Html/PHP code.
Here you have to modify SQL Statement.
<form action="submit.php"
onSubmit="return validate()" method="post">
<input type="hidden" id="st_val" name="store_del">
<input type="submit" value=" Submit " >
</form>
<form>
<table><tr><td><input type='checkbox' id="ch_all" name='checkbox'
onClick="if(this.checked)checkAll(); else clearAll()" />
</td>
<td><b>9lessons | Tutorials</b></td>
</tr>
<?php
$sql=mysql_query("some SQL statement");while($row=mysql_fetch_array($sql))
{
$id=$row['user_id'];
$message=$row['message'];
?>
<tr><td><input type='checkbox' name='check_del' onclick='test()'
value='<?php echo $id; ?>' />
</td><td> <?php echo $message; ?> </td></tr>
<?php } ?>
</table></form>
Explode! Comma(,) php script
Watch demo 'store_del' value split Comma with below PHP fucntion
<?php
if(isset($_POST))
{
$st_val = $_POST['store_del'];
$store_del_exp = explode("," ,$st_val);
echo $store_del_exp;
$store_del_exp_count=count($store_del_exp); for($j=0; $j<$store_del_exp_count;$j++)
{
$t_id = trim($store_del_exp[$j]);
echo $t_id;
}
}
?>
Dear Srinivas,
ReplyDeleteIf we are going to delete the selected records, how to display the new results after submit without refreshing the whole page?
Thanks
can this work without the tags?
ReplyDeletewhen we click on submit button why a word "Array" comes in result...????
ReplyDeletethanks its working
ReplyDeletei will upload this with my website soon.
ggood one
ReplyDelete