This example or tutorial is about the checkbox in PHP. It is
a web form having three checkboxes and two buttons “Select All”, “Deselect
All”. “Select All” button purpose is to checked all three checkboxes and
“Deselect All” button used for unchecked all three checkboxes.
Select and Deselect All Checkboxes |
PHP Code
<html>
<body>
<form
id="form1" action="Checkbox.php?process"
method="post">
<input
type="checkbox" id="Checkbox1" name="Checkbox1" <?php if(isset($_GET['process'])){ echo
"checked=true"; } ?>> Checkbox 1
<input
type="checkbox" id="Checkbox2" name="Checkbox2" <?php if(isset($_GET['process'])){ echo
"checked=true"; } ?>> Checkbox 2
<input
type="checkbox" id="Checkbox3" name="Checkbox3" <?php if(isset($_GET['process'])){ echo
"checked=true"; } ?>> Checkbox 3
</br></br>
<input
type="submit" id="submit" value="Select All"
/>
</form>
<form
id="form1" action="Checkbox.php"
method="post">
<input
type="submit" id="submit2" value="Deselect All"
/>
</form>
</body>
</html>
OUT PUT
when you click on the "Select All" button the output will...
Select all checkboxes |
when click on the "Deselect All" button output wil...
Deselect all checkboxes |
Note:
copy and paste PHP code in php file and you must save it with the name of "Checkbox.php".
No comments:
Post a Comment