•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 397,798 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,372 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 3927 | Replies: 1
![]() |
•
•
Join Date: Jul 2006
Posts: 6
Reputation:
Rep Power: 0
Solved Threads: 0
Dear all
I need to build a search with 2 select boxes like;
Search
I need the second box to be populated according to the first. (The first one will be populated by me and not from the database with 5 or 6 values).
After the second drop down is populated I need after selecting a value data from the database to come up according to the selection while one cell’s values to be hyperlinked.
TITLE REFERENCE COUNTRY YEAR
Computer science Willey and Sons England 1997
Environment in the 21st Howard publications Germay 2001
After selecting one hyperlinked value the full study will come up in table format.
Many thanks in advance
Best Regards.
I need to build a search with 2 select boxes like;
Search
I need the second box to be populated according to the first. (The first one will be populated by me and not from the database with 5 or 6 values).
After the second drop down is populated I need after selecting a value data from the database to come up according to the selection while one cell’s values to be hyperlinked.
TITLE REFERENCE COUNTRY YEAR
Computer science Willey and Sons England 1997
Environment in the 21st Howard publications Germay 2001
After selecting one hyperlinked value the full study will come up in table format.
Many thanks in advance
Best Regards.
Last edited by tzan2833 : Sep 21st, 2006 at 5:50 am.
In order to change something on the fly you would have to use Javascript.... However javascript cannot activate a PHP statement because it is a server side script and Javascript is client side.
You would have to use javascript to Submit the form when something is selected, and have the form reload the page with the selection. Than have PHP read the selection, and populate the second Select box from the database.
For example:
Hope this helps
You would have to use javascript to Submit the form when something is selected, and have the form reload the page with the selection. Than have PHP read the selection, and populate the second Select box from the database.
For example:
<?php
$selected = $_POST['selected'];
if ($selected != "")
{
// MySQL commands to retrieve the info depending on what was selected
}
?>
//Page Code Here
<form action="thispage.php" method="post" name="first_form">
<select name="first_select" onChange="document.first_form.submit();">
</form>
<form action="search.php" method="post" name="second_form">
<?php
//Use a for loop to go through the array of info recieved from the database and populate the second select field
?>
<input type="submit>
</form>
Hope this helps
Last edited by GliderPilot : Sep 21st, 2006 at 3:42 pm.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
- Selecting mutiple data options in Access2003 listbox or combo box (MS Access and FileMaker Pro)
- writitng data from php to mysql (PHP)
- Select Box populates text field (JavaScript / DHTML / AJAX)
- populate a select box using PHP (PHP)
- passing values of Select box from JSP to Action class thru form Bean (JSP)
- Error message while importing data to Excel from the MySQL db (MySQL)
Other Threads in the PHP Forum
- Previous Thread: unserialize an array! spitting out jibberish
- Next Thread: website help


Linear Mode