| | |
bringing data from mysql using select box
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2006
Posts: 6
Reputation:
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 6: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 Syntax (Toggle Plain Text)
<?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 4:42 pm.
![]() |
Similar Threads
- passing values of Select box from JSP to Action class thru form Bean (JSP)
- 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)
- 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
| Thread Tools | Search this Thread |
.htaccess alerts apache api archive array autocomplete beginner binary broken cakephp checkbox class cms code convert cron curl database dataentry date display duplicates dynamic echo email emptydisplayvalue error execute explodefunction file files firstoptioninphpdroplist folder form forms function functions google hack href htaccess html htmlspecialchars image include insert ip javasciptvalidation javascript joomla keywords limit link login mail matching menu methods mlm multiple mysql network object oop paypal pdf php problem query radio random recursion recursive redirect remote script search securephp server sessions shot sms source space sql subscription syntax system table tutorial tutorials update upload url validator variable video web youtube





