Newbie Alert - populating form fields
| From: | Beth Clark | Date: | Fri, 14 Jul 2000 15:19:23 +0000 |
| Subject: | Newbie Alert - populating form fields | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-6650@lists.php.net to get a copy of this message | ||
Not only new to PHP, but new to programming too, so please bare with me:)
I have a form that I want to populate with data from one table and insert
into another table. I've managed so far to populate a drop down menu from
the first table, but how do I populate the other fields once one of those
items is selected?
What I have so far is the drop down menu:
<?
$query = "select * from Courses";
$result = mysql_query($query);
$num = mysql_numrows($result);
echo "<font face=\"Arial\">Please choose the course you would like to
schedule:</font><br><br>";
echo "<font face=\"Arial\"
color=\"blue\">Course:</font><br>";
echo "<select name=\"Course\"Course_ID=Course_ID>";
echo "<option value='' selected>***Select a Course***</option>";
/*Dynamically generate drop-down list*/
$i=0;
while ($i<$num):
$hello = mysql_result($result,$i, "CourseTitle");
echo "<option value='$hello'>$hello</option>";
$i++;
endwhile;
echo "</select><p>";
?>
and a field;
Audience:<br></font><textarea name="Audience" rows="5"
cols="25" wrap><?
echo "$Aud"; ?></textarea></td>
Will someone please point me in the right direction for tutorials or scripts
or whatever on how to code "if Course A is selected, than Audience=
$Audience from table Courses where Course A = Course A". I know I'm missing
something fundamental here and I'm running out of time before deadline! TIA
Beth