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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <?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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | <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.