16
Nov
Submit Checkbox values using javascript in form
- Category:
- PHP
Posted On : November 16, 2013
| No Comment
We can submit checkbox values using javascript into form. Lets see how we can do it.
Step : 1 ) Create index.php file HTML and PHP code.
View Code PHP
<form action="postform.php" method="post"> <input id="check_val" name="check_del" type="hidden" /> <input name="btnSubmit" type="submit" value=" Submit " /> </form> |
Step : 2) Now add php code as per given below
View Code PHP
<form> <?php $sql=mysql_query("SQL statement"); while($row=mysql_fetch_array($sql)) { $id=$row['user_id']; $message=$row['message']; ?> <?php } ?> <table> <tbody> <tr> <td> <input id="check_all" onclick="if(this.checked)checkAll(); else clearAll()" name="checkbox" type="checkbox" /></td> <td><strong>All Post here</strong></td> </tr> <tr> <td> <input onclick="testfun()" name="check_del" type="checkbox" value="<?php echo $id; ?>" /></td> <td> <?php echo $message; ?></td> </tr> </tbody> </table> </form> |
- Tags: