<?php
$salaries = array(1000,1500,2000,2500,3000,4000,5000,6000,7000,9000,12000,18000,30000);
$str = '';
foreach($salaries as $salary)
{
$str .= "<option value=\"$salary\">$salary+</option>";
}
function populateSalary()
{
$salaries = array(1000,1500,2000,2500,3000,4000,5000,6000,7000,9000,12000,18000,30000);
$str = '';
foreach($salaries as $salary)
{
$str .= "<option value=\"$salary\">$salary+</option>";
}
return $str;
}
?>
<select id="salaryExpect" name="salaryExpect">
<option value="-1">--<option>
<?php echo populateSalary(); ?>
</select>
See?There is no such empty option as <option> </option>
in the code,but strange enough there is in the output.
Can have a look here: http://maishudi.com/test3.php