Skip to content Skip to sidebar Skip to footer

Post Array From Html To Php

Im pretty new to php programing but im trying to pass the values from a multislect object im html to some code in PHP that will then email the listed people However the vairable pa

Solution 1:

To pass it in as an array of values, add square brackets to the name attribute of your select element..

<select name="names[]" multiple="multiple"> 

Then you can iterate over the values in php.

foreach ( $_POST['names'] as$selectedOption )

Solution 2:

foreach ($_POST['Names'] as$selectedOption)
    echo$selectedOption."\n";

Solution 3:

when I use this:

foreach ( $_POST['names'] as $selectedOption )

and I insert in the database "$selectedOption" appear in the database this:

on

Post a Comment for "Post Array From Html To Php"