Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Second list box values changing according to selection of first list box

Posted on 2005-04-21
Medium Priority
Last Modified: 2008-02-01

I have simple table that lists cars, trucks etc. I would like to put those values to list box. And I want to have another list box as well. If user selects cars, it will go to another table and read cars there and list them at second list box. If user select trucks, it will automatically select trucks from table and list them at second list box.

If you could please help, it will be great.

Question by:hasozduru
LVL 12

Accepted Solution

str_kani earned 1000 total points
ID: 13840383
list1 (for selecting car or trucks)

list2 (for showing the cars..)

list3 (for showing the trucks..) right?

you can do that using only one list box,!

when the user select something in the list1, fetch all data needed from the     db and fill it in the list2.  


<select name="sel1">
<option value="car">Car</option>
<option value="truck">Truck</option>

<select name="sel2">
if ($selected_option=="car")
//select query for car
}elseif ($selected_option=="truck")
//select query for truck

<option value="<?php $row[0]?>"><?php $row[0]?></option>

Author Comment

ID: 13844204
This example did not help me. I am looking for something like at www.easyjet.com site. Please visit and select "from" list box and see how "to" list box changes according to "from" one.


Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question