A
Anonymous
Guest
I have a HTML form with dropdown list (<select> and <option>) to show doctor's codes. For example, the codes and the related names are:
Code Name
-------------------
001 Dr. One
002 Dr. Two
003 Dr. Three
What I want is, everytime I select the code from the list, I want the name of the doctor is also showed on the same page.
I'm using PostgreSQL database. Table in PostgreSQL :
table name : doctors
field : docID, docName
Here is my code:
--------------------
<tr>
<td>Code</td>
<td>:</td>
<td>
<table>
<tr>
<td>
<select name="code">
<?
$db=pg_connect("host=localhost dbname=dbhis user=user");
$result=pg_query($db,"select * from doctors;");
while (list($docID) = pg_fetch_row($result)) {
echo "<option value=\"$docID\">$docID</option>";
}
pg_close($db);
?>
</select>
</td>
<td>Name</td>
<td>:</td>
<td>
<?
...........
...........
?>
</td>
</tr>
The code to show doctor's code works fine, but I can't find a way to show the name. What should I fill in the blanks?
Please help me. I'm really stuck. Thanks a lot.
rgrds,
jenny
Code Name
-------------------
001 Dr. One
002 Dr. Two
003 Dr. Three
What I want is, everytime I select the code from the list, I want the name of the doctor is also showed on the same page.
I'm using PostgreSQL database. Table in PostgreSQL :
table name : doctors
field : docID, docName
Here is my code:
--------------------
<tr>
<td>Code</td>
<td>:</td>
<td>
<table>
<tr>
<td>
<select name="code">
<?
$db=pg_connect("host=localhost dbname=dbhis user=user");
$result=pg_query($db,"select * from doctors;");
while (list($docID) = pg_fetch_row($result)) {
echo "<option value=\"$docID\">$docID</option>";
}
pg_close($db);
?>
</select>
</td>
<td>Name</td>
<td>:</td>
<td>
<?
...........
...........
?>
</td>
</tr>
The code to show doctor's code works fine, but I can't find a way to show the name. What should I fill in the blanks?
Please help me. I'm really stuck. Thanks a lot.
rgrds,
jenny