well, in that case, let me explain the code I gave ya:
<?
if (!$cnty_id) {
// This means if the $cnty_id variable is
// not present, then execute the code below
$sel_name = "cnty_id";
// Set the select form name here so we can
// use the same display code
$qry = "select cnty_id,cnty_name " .
"from country " .
"order by cnty_name";
$res = pg_exec($conn,$qry);
// creates/executes the query...
// in mysql, this would be
// mysql_query($query);
// assuming you have established a connection
// to the database sometime earlier
$tick = 0;
while($row = @pg_fetch_array($res,$tick++)) {
// loop through the result to create an
// array of the info you want
// in mysql, tis would be
// while($row = mysql_fetch_array($res)) {
$drop_list[$row[cnty_id]] = $row[cnty_name];
}
} else if (!$st_id){
$sel_name = "st_id";
$qry = "select st_id,st_name " .
"from state " .
"where cnty_id = $cnty_id " .
"order by st_name";
$res = pg_exec($conn,$qry);
$tick = 0;
while($row = @pg_fetch_array($res,$tick++)) {
$drop_list[$row[st_id]] = $row[st_name];
}
} else {
// do whatever you want with $st which
// will be the state id
}
?>
<form method="post" action="<?= $PHP_SELF ?>">
<select name="<?=$sel_name ?>">
<? while(list($k,$v) = @each($drop_list)) { ?>
<option value="<?= $k ?>"><?= $v ?>
<? } ?>
</select>
</form>