Notice: Undefined variable: opt in G:\rutadelaweb\select.php on line 10
Código PHP:
<?php
$hand = mysql_connect('localhost', 'root', '');
mysql_select_db("facturador", $hand);
$qry = mysql_query("select * from clientes", $hand);
while ($rec = mysql_fetch_array($qry))
{
if ( $rec['cif'] == 1 )
$opt = $opt."<option value=".$rec['cif']." selected>".$rec['razonsocial']."</option>\n";
else
$opt = $opt."<option value=".$rec['cif'].">".$rec['razonsocial']."</option>\n";
}
echo <<< HTML
<form method="POST" action="" name="empresas">
Cliente <select size="1" name="empresas" tabindex="1">
$opt
</select><br><br>
<input type="submit" value="Enviar" name="enviar" tabindex="2"><input type="reset" value="Borrar" name="borrar" tabindex="3"></p>
</form>
HTML;
?>