List:General Discussion« Previous MessageNext Message »
From:Douglas Brantz Date:May 8 2000 2:52am
Subject:Re: Drop Down Menu with defined Data:
View as plain text  
Ben,
Thanks for the link-

I've already got something like that - I guess I can make the query to Mysql
before the Javascript.  Looks like they ran into the same problem I did and
they had to insert the "---------------" so that the displayed data could  read
properly.

But couldn't I pull the selected data with a param statement?
Check out the example below and let me know if this will work.

 print "Please Select your College";
my $sth = $dbh->prepare("select college from list")
 $sth->execute;
my @arr=();
while (@arr = $sth->fetchrow_array())
 {
($college)=@arr;
 $college = $college;
 print $query->popup_menu (-name=>'COLLEGE',
                          -"values"=>['$college',

 ],
 -default=>$defaultcollege);
 }
 $sth->finish();
## now grab the choice from the drop down menu?
my $choice = $query->param("COLLEGE");
## would I need to add my $query= new CGI;
##and then I could plug $choice into the next select statement:

 ## second drop down menu
print "<BR>";
 print "Please Select the Department</td><td>";
 my $sth = $dbh->prepare("select dept from list
 where college="$choice" ")
 $sth->execute;
 my @arr=();
 while (@arr = $sth->fetchrow_array())
 {
 ($dept)=@arr;
 $dept = $dept;
 print $query->popup_menu (-name=>'DEPT',
                          -"values"=>['$dept',

 ],
 -default=>$defaultdept);
 }



benjamin-weiss wrote:

> Doug,
>
> I ran across a site the other day that does something like this.  I looked
> at the source, and they're using javascript, but a good part of that script
> can be generated dynamically from MySQL.
>
> The link is:
>
> http://www.csd.toshiba.com/cgi-bin/tais/home.jsp
>
> Then choose the Technical Support link at the top right, then the Tech
> Support Center in the middle.  You'll see three list boxes.  Have fun!
>
> Ben
> ----------------------------
> BENJAMIN J. WEISS
> 2LT, SC, OKARNG
> 45th Infantry Brigade (SEP)
> Signal Platoon Leader
>

Thread
Drop Down Menu with defined Data:Douglas Brantz8 May
  • Re: Drop Down Menu with defined Data:Douglas Brantz8 May
    • RE: Drop Down Menu with defined Data:benjamin-weiss8 May
      • Re: Drop Down Menu with defined Data:Douglas Brantz8 May
        • Re: Drop Down Menu with defined Data:Christopher R. Jones8 May
        • RE: Drop Down Menu with defined Data:benjamin-weiss8 May