Tuesday, 17 March 2015

Populate element of array in a combolist

I am an oracle professional and work as a pl sql developer. I am soon working on connectivity of php with oracle. Like retrieving list of values in a combo box. In this example there is nothing about oracle but a simple array of values and populating those values in a combo box.


<html>
<head>
<title>Populate element of array in a combolist</title>
</head>
<body>
<?php
   $fruits = array("Apple", "Orange", "Grapes","Banana","Pinapple");
   echo "<select name='cmbList'>";
   for($i=0;$i<count($fruits);$i++)
       echo "<option id=".$i.">".$fruits[$i]."</option>";
    echo "</select>";
?>
</body>
</html> 

No comments: