Esta raro lo probe y me funciono como tu lo hiciste, lo más probable es que se te ha olvidado llamar la función. Te sugiero mejor hacerlo de esta forma, pero si lo quieres hacer como la tuya como quiera funciona.
Código PHP:
Ver original<?php
function formulario($habitaciones){
$f = "<form>
<input type='text' name='$habitaciones' size='3'>
<input type='submit'>
</form>";
return $f;
}
echo formulario("algo");
Y esta es la forma como tu debes llamarlo con la tuya
Código PHP:
Ver original<?php
function formulario($habitaciones){
echo "<form>";
echo "<input type='text' name='$habitaciones' size='3'>";
echo "<input type='submit'>";
echo "</form>";
}
formulario("algo");