Saved X
Google login
SignUp with Email
X

How to display checked checkbox value in php

theindreshverma ( Added  May 07, 10:53 pm )
Login

<form action="#" method="post">
   <input type="checkbox" name="list[]" value="C" id="c"> <label for="c">C</label> </br>
   <input type="checkbox" name="list[]" value="Java" id="java"> <label for="java">Java</label> </br>
   <input type="checkbox" name="list[]" value="PHP" id="php"> <label for="php">PHP</label> </br>
   <input type="submit" name="submit" value="Submit" />
</form>

<?php
if(isset($_POST['submit'])) {
   if(!empty($_POST['list'])) {
      foreach($_POST['list'] as $selected) {
         echo $selected . "</br>";
      }
   }
}
?>

Sourcecode Tags

More Sourcecodes

More Sourcecodes