Adam Khoury

Donate funds to show love and support

Click the button below to donate funds securely online. You can use your PayPal account or a credit card.

Your donations help free up my time to produce more content and assist in covering server costs. It's also a great way to say thanks for the content!

Application Configuration

Adam will be adding options here soon.

Multiple Select HTML Form Fields PHP Parse Tutorial

Published :
Author :
Adam Khoury
Here we instruct how to use PHP to parse multiple selection form fields in your HTML or HTML5 forms. The resulting variable is an array if you instruct the select field to handle multiple options. We have to break this array down to split the selections for our data processing needs, or you can choose to save the serialized complete array into one MySQL database field. <?php // Written by Adam @ DevelopPHP.com if(isset($_POST['skills'])){ $skillsArray = $_POST['skills']; // echo $skillsArray; // Echos the "Array" object $i = 0; foreach ($skillsArray as $key => $value) { $i++; echo "Skill $i || Array Key = $key || Value = $value<br />"; } exit(); } ?> <h3>Multiple Select HTML Form List PHP Parsing Tutorial</h3> <form action="multi_select_parsing.php" method="post" name="myform"> What skills do you have? <br> (hold "Ctrl" key to select multiple): <br><br> <select name="skills[]" multiple="multiple"> <option value="HTML5">HTML5</option> <option value="CSS3">CSS3</option> <option value="Javascript">Javascript</option> <option value="Actionscript">Actionscript</option> <option value="PHP">PHP</option> <option value="MySQL">MySQL</option> </select> <br><br> <input name="myBtn" type="submit"> </form>