PHP 7 Script to Get Value From Multiple Selected HTML5 Checkboxes in Browser Full Project For Beginners

  • Post author:
  • Post category:PHP
  • Post comments:0 Comments

 

Welcome folks today in this blog post we will be getting value from multiple selected html5 checkboxes in browser using php 7. All the full source code of the application is shown below.

 

 

 

Get Started

 

 

 

In order to get started you need to make an index.php file and copy paste the following code

 

 

index.php

 

 

 

<form action="action_page.php" method="POST">
  <input type="checkbox" name="color[]" value="Red"> Red<br>
  <input type="checkbox" name="color[]" value="Blue"> Blue<br>
  <input type="checkbox" name="color[]" value="Black"> Black<br>
  <input type="checkbox" name="color[]" value="Green"> Green<br>
  <input type="checkbox" name="color[]" value="Yellow"> Yellow<br>
  <input type="submit" name="submit" value="submit">
</form>


if (isset($_POST['color'])) {

  foreach ($_POST['color'] as $color) {
    echo $color."<br>";
  }
}

Leave a Reply