In message <[EMAIL PROTECTED]>, zerulogs <[EMAIL PROTECTED]>
writes
>Hi folks!
>
>Im just new here trying to find solution to my problem. Been trying to
>search the web but can't find one. Hope to find some help here. thanks.
>
>Here's the scenario.
>
>Example.
>I have 2 tables,
> 1. Member (fields: Name, Status, Age)
> 2. Status (field: Status)
>
>I want to update the record on Member table using an update form. I
>want the field Status on the Update Form to use a list/menu rather
>than textfield. The Status link/menu is then linked to table Status
>but I'd like to display the current record already on the Member table.
>
>How to do it in PHP MySQL?
>
>Please I need your help.
>
>Many thanks,
>
>zeru
This is from some very old code (so excuse the tables), and has been
simplified, so probably won't work first time, but...
<?php
Select the name, status and age of the record...
then...
list($name, $status, $age)=mysql_fetch_array($result)
?>
<table border=1 align="center">
<tr>
<td>Name</td>
<?php
echo "<td><input name='name' value='$name'></td>";
?>
</tr>
<tr>
<td>Status</td>
<?php
$qry = "SELECT status FROM statustable";
$result = mysql_query($qry);
echo '<td><select name="status">';
while (list($statusid)=mysql_fetch_array($result)) {
echo "<option value=$statusid";
if ($statusid==$status) echo ' selected="selected"';
echo '>$statusid</option>";
}
?>
</select>
</td>
<tr>
<td>Age</td>
<?php
echo "<td><input name='age' value='$age'></td>";
?>
</tr>
</table>
Hope that helps...
--
Pete Clark
Sunny Andalucia
http://hotcosta.com/Andalucia.Spain