Hello!
I'm using the following PHP/Javascript code to create a drop down list. It's part of a longer group of code which dynamically changes a second drop down list based on what's chosen here. After the user submits their choice, I use PHP to grab relevant information, based on their choice, from my database. They're going to be going through the process several times and it would be great if I could reselect whatever they just posted. Might there be a way to reselect whatever they $_POSTed the first time? If I could have some guidance for this piece of the code, I can hopefully figure out how to implement it in my 2nd drop down menu as well.
Thanks so much!
-Eric
PHP Code:$q1=mysql_query("select * from assignments_topics");
echo mysql_error();
$already_listed_chapters=array();
while($nt1=mysql_fetch_array($q1)){
if (!in_array($nt1['menu_chapter_name'],$already_listed_chapters)){
array_push($already_listed_chapters,$nt1['menu_chapter_name']);
echo "addOption(document.drop_list.Chapter, '$nt1[chapter_name]', '$nt1[menu_chapter_name]');";};
}// end of while



Reply With Quote





Bookmarks