php - HTML Element Array, name="something][ or name="something

Mots clés : phphtmlphp

meilleur 3 Réponses php - HTML Element Array, name="something][ or name="something

vote vote

93

$educationValues = $_POST['education']; // Returns an array print_r($educationValues); // Shows you all the values in the array 
<p><label>Please enter your most recent education<br>     <input type="text" name="education[]"> </p> <p><label>Please enter any previous education<br>     <input type="text" name="education[]"> </p> <p><label>Please enter any previous education<br>     <input type="text" name="education[]"> </p> 
document.getElementById("education1"); 
<p><label>Please enter your most recent education<br>    <input type="text" name="education[]" id="education1"> </p> 
vote vote

83

<input type="checkbox" name="fruits[]" value="orange"/> <input type="checkbox" name="fruits[]" value="apple"/> <input type="checkbox" name="fruits[]" value="banana"/> 
<select name="fruits[]" multiple>     <option>apple</option>     <option>orange</option>     <option>pear</option> </select> 
vote vote

71

<input type="text" name="education[]" value="1"> <input type="text" name="education[]" value="2"> <input type="text" name="education[]" value="3"> 
<input type="text" name="education" value="1"> <input type="text" name="education" value="2"> <input type="text" name="education" value="3"> 

Questions similaires