php checkbox -multiple Checkbox value in PHP
In This simple lesson we will learn how to get multiple checkbox value in php..just follow the below php checkbox example:
php checkbox --Get html Checkbox value using PHP |
we use below php codes process checkbox value:
<?php if(isset($_POST['submit'])){ if(!empty($_POST['company'])){ $company=$_POST['company']; echo '<div style=color:red size=4>You Have Selected Total '.count($_POST['company']).' Checkbox</div>'; foreach($company as $row){ echo $row.'<div></div>'; } }else{ echo 'You Have not Select any Value'; } } ?>
php checkbox full codes: index.php
<html> <head> <title>Get Multiple Checkbox Value in PHP</title> </head> <form method="POST" action=""> <table> <tr> <td><input type="checkbox" name="company[]" value="Google Inc"/>Google Inc</td> </tr> <tr> <td><input type="checkbox" name="company[]" value="Apple Inc"/>Apple Inc</td> </tr> <tr> <td><input type="checkbox" name="company[]" value="Smasung Inc"/>Smasung Inc</td> </tr> <tr> <td><input type="checkbox" name="company[]" value="LG Inc"/>LG Inc</td> </tr> <tr> <td><input type="submit" name="submit" value="Click To Process"/></td> </tr> </table> </form> </html> <?php if(isset($_POST['submit'])){ if(!empty($_POST['company'])){ $company=$_POST['company']; echo '<div style=color:red size=4>You Have Selected Total '.count($_POST['company']).' Checkbox</div>'; foreach($company as $row){ echo $row.'<div></div>'; } }else{ echo 'You Have not Select any Value'; } } ?>
That's it friends how to get multiple checkbox value in php..Thank You...
No comments:
Post a Comment
Thank You for Your Comment
Note: Only a member of this blog may post a comment.