Answers for "php drop down menu"

21

html select list

<label for="cars">Choose a car:</label>

<select id="cars">
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="mercedes">Mercedes</option>
  <option value="audi">Audi</option>
</select>
Posted by: Guest on April-13-2020
0

php static dropdown list example

<?php
$toy_cars = array("Pull Back Cars","Remote Cars", "Electric Cars", "Toy Race Cars","Lightening Cars");
$array_length = count($toy_cars);
?>
<select name="dynamic_data">
<?php
for ($i=0;$i<$array_length;$i++){
?>
<option value="<?=$toy_cars[$i];?>"><?=$toy_cars[$i];?></option>
<?php
}
?>
</select>
Posted by: Guest on September-14-2020
9

html create drop down list

<html>
 <head>
   <title>Selection Inputs</title>
 </head>
 <body>
   <form>
     <label for="selector"> <!-- Can add label if want -->
       <p>A "select" element allows users to input from a selection:</p>
       <select id="selector"> <!-- Use "select" to create object -->
         <option>Option 1</option> <!-- Add all applicable options -->
         <option>Option 2</option>
         <option selected>Option 3</option> <!-- add selected to change default from first option -->
         <optgroup label="Group"> <!-- To create nested options for categories use "optgroup" -->
           <option>Option 4</option>
           <option>Option 5</option>
       </select>
     </label>
   </form>
 </body>
</html>
Posted by: Guest on March-10-2020

Browse Popular Code Answers by Language