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.

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:

<?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


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.