â ī¸ Warning â ī¸ Deprecated Code! This video tutorial contains outdated code.
đĄ If you wish to update it, any AI assistant will update the code for you in seconds.
đĄ If you wish to update it, any AI assistant will update the code for you in seconds.
Multiple Select HTML Form Fields PHP Parse Tutorial
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
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>