<?php
include('SelectOption.class.php');
$data_array = array('1'=>'one' , '2'=>'two' , '3'=>'three' , '4'=>'four');
$obj = new SelectOption($data_array); //data array is key=>value format
$obj->setSelectedIndex('2'); //--- set <option value="2" selected="selected">two</option>
?>
<html>
<head>
<title>Select Option Example</title>
</head>
<body>
<select name="select1">
<option value="">--- please select ---</option>
<?php echo $obj->printOption(); ?>
</select>
</body>
</html>
|