You don't need to use recursion here (recursion == a function calling itself). You should use a loop instead. Using a loop also happens to make it easy to put the select tag in there too:
<?php
function pri($name, $count) {
echo "<select name=\\"$name\\">\\n";
for ($i = 0; $i < $count; $i++) {
print("<option value=\\"$i\\">$i</option>\n");
}
echo "</select>\\n";
}
// this is the function call
pri("test", 10);
?>
That will give you options 0-9. Change the second argument (currently 10) to 20 and you'd get 0-19 instead.
The following would be a bit more general, though not as good for simple number sequences:
function html_select($name, $options) {
echo "<select name=\\"$name\\">\n";
foreach ($options as $value => $text) {
$value = htmlentities($value);
$text = htmlentities($text);
echo "<option value=\\"$value\\">$text</option>\n");
}
echo "</select>\\n";
}
$foods = array(
1 => "Apple",
2 => "Banana",
3 => "Carrot",
4 => "Date",
5 => "Eggplant",
);
html_select("favorite_food", $foods)