Wall Script
Follow Me:
Friday, March 13, 2009

Submit Checkbox values in Form with javascript

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.

Download Script     Live Demo

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 " >

<input type='checkbox' id="ch_all" name='checkbox'
onClick="if(this.checked)checkAll(); else clearAll()" />
<td><b>9lessons | Tutorials</b></td>
$sql=mysql_query("some SQL statement");
<input type='checkbox' name='check_del' onclick='test()'
value='<?php echo $id; ?>' />
</td><td> <?php echo $message; ?> </td></tr>
<?php } ?>

Explode! Comma(,) php script
Watch demo 'store_del' value split Comma with below PHP fucntion


$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;

Download Script     Live Demo
Prasad said...

Dear Srinivas,

If we are going to delete the selected records, how to display the new results after submit without refreshing the whole page?


adreae said...

can this work without the tags?

Anonymous said...

when we click on submit button why a word "Array" comes in result...????

Telli Sports said...

thanks its working

i will upload this with my website soon.

Anonymous said...

ggood one

Post a Comment