<?php $result = null; if(isset($_POST['submit'])) { $foods = $_POST['foods']; foreach ($foods as $food){ echo "You like {$food} <br>"; } } ?> <form action="index.php" method="post"> <input type="checkbox" name="foods[]" value="pizza"> pizza <br> <input type="checkbox" name="foods[]" value="hamburger">Hamburger <br> <input type="checkbox" name="foods[]" value="hotdog"> hotdog <br> <input type="checkbox" name="foods[]" value="taco"> taco <br> <input type="submit" value="Submit" name="submit"> </form>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter