Code: Select all
<?php
function get_combo_select($name, $source, $label)
{
$res = db_query("select * from " . $source);
$work = "<select name=\"$name\">\n";
while ($row = mysql_fetch_array($res))
{
$work .= ' <option value="' . $row['code'] . '">' . $row['description'];
}
return $work . "</select>\n";
}
?>
I'm trying to call it like this:
Code: Select all
<? php echo(get_combo_select("shape","shape","Shape"); ?>
What am I doing wrong? This is the error I get:
Code: Select all
Parse error: parse error, unexpected T_ECHO in C:\Apache\htdocs\add_record.php on line 31
Thanks in advance