First you need a form to enter the id number for the query.
Having submited the form, retrieve the id variable.
Query your database to get the name and address for the selected id.
Display the name and address fields from the query on the page.
Save the sample code below as "sample.php" (you need port number for the connection). NB Its untested but should get you started.
<html>
<!-- Creation date: 01/11/02 -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Sample</title>
<meta name="Author" content="Barand">
<meta name="Generator" content="AceHTML 4 Pro">
</head>
<body>
<!-- Form action calls itself in this example -->
<form action="<?=$PHP_SELF?>" method="get">
Enter ID : <input type="text" name="id" size="4" maxlength="4" >
<input type="submit" value="Get address">
</form>
<hr>
<!-- Get the id if there is one -->
<?
if (isset($GET["id"])) {
$id = $GET["id"];
$conn = pg_connect("dbname=mydatabase port=????");
$sql = "select name,address from members where id=$id";
$result = pg_exec($conn,$sql);
if (list($name,$address) = pg_fetch_row($result,1)) {
echo "$name<br><br>$address";
} else {
echo "ID: $id not found";
}
}
?>
</body>
</html>