Re: Newbie Alert - populating form fields

From: Date: Fri, 14 Jul 2000 17:53:27 +0000
Subject: Re: Newbie Alert - populating form fields
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-6684@lists.php.net to get a copy of this message
You are missing something fundamental :) PHP is server side, and therefore the only way to do that with php is to pass a variable to that page and reload it. What you can do to keep it simpler, is use JavaScript.... JavaScript is your friend. You would make the php generate the javascript... Uhm, I am pretty new myself so it would take me some time to write that code, and I don't have that much time, so maybe someone that is more competent can write it for you. But I did what you asked, pointed you in the right direction :) Hope this helped Ed "Beth Clark" <elisaclark@earthlink.net> wrote in message news:B5947D8A.3823%elisaclark@earthlink.net... > 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 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#6684) next »