Skip to content

How to display checked checkbox value in PHP?

 htmlCopy# html 5
<form action="index.php" method="post" >
<input type="checkbox" name="test1" value="value1"> Option 1
<input type="checkbox" name="test2" value="value2"> Option 2
<input type="submit" value="Submit"> 
</form>

   #php 7.x
<?php
if(isset($_POST['test1'])){
    echo "checked value1"."<br>";
}
if(isset($_POST['test2'])){
    echo "checked value2";
}
?>
See also  CSS code snippet - How to install gotham rounded as a font in visual studio for my file?
, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.