1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| <form name="frm" method="post" action="./page_travaux.php">
Sélectionnez une commune<select name="zl_commune">
<option value="0">Toutes</option>
<?php
include('./inclusion/connect.inc');
$idc=connect();
$sql='select num_commune, nom_commune from commune order by commune';
$rs=pg_exec($idc,$sql);
while ($lg=pg_fetch_assoc($rs))
{
print('<option value="'.$lg['num_commune'].'">'.$lg['nom_commune'].'</option>');
}
?>
</select><br />
</form>
Concernant la connection à la base, voici ce que j'ai fait:
<?php
function connect()
{
$idc=pg_connect('user=postgres password=postgres dbname=reseau host=localhost port=5432');
return($idc);
}
?> |