|
|
|
|
![]() ![]() |
Aug 10 2007, 09:12 PM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 400 Joined: 21-June 05 From: Callifornia Member No.: 8,519 |
Allright so heres the deal..
Im trying to make a 3 teir dropdown Sort, Order, User both will be populated by a database so dont worry about the content inside of them they will be the same stuff in both but in a diffrent order by using php (ajax i guess is what it is since its javascript with php lol) CODE <html> <head> <script src="selectuser.js"></script> </head> <body> <?php $c=mysql_connect ("localhost", "database", "password") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("database"); echo "<form> Sort by:<select name=\"sort_by\"> <option value=\"Name\">Name</option> <option value=\"level\">Level</option> <option value=\"email\">Email</option> <option value=\"cash\">Cash</option> </select> <select name=\"sort_by\"> <option value=\"DSC\">DSC</option> <option value=\"ASC\">ASC</option> <option value=\"RAND\">RAND</option> </select> Select a User: <select name=\"users\" onchange=\"showUser(this.value)\">"; $sql="SELECT * FROM users"; $result=mysql_query($sql); while ($row=mysql_fetch_array($result)) { echo "<option value=\"{$row['userid']}\">{$row['username']}</option>"; } mysql_close($c); ?> </select> </form> <p> <div id="txtHint"></div> </p> </body> </html> heres the page as of right now http://www.clashofages.com/ajax_demo/user_demo.php |
|
|
|
Sep 29 2007, 11:16 AM
Post
#2
|
|
|
Newbie [Level 1] ![]() Group: [HOSTED] Posts: 21 Joined: 29-September 07 Member No.: 50,836 |
You need this code:
QUOTE echo
"<form name=\"sort\"> <select name=\"sort_by\" onChange=\"java script:document.sort.sort_by1.disabled = false;\"> <option value=\"default\">Please select!</option> <option value=\"Name\">Name</option> <option value=\"level\">Level</option> <option value=\"email\">Email</option> <option value=\"cash\">Cash</option> </select> <select name=\"sort_by1\" disabled> <option value=\"DSC\">DSC</option> <option value=\"ASC\">ASC</option> <option value=\"RAND\">RAND</option> </select> </form>" |
|
|
|
Sep 29 2007, 02:13 PM
Post
#3
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 791 Joined: 13-April 07 From: mreža Member No.: 41,558 |
I cannot load you site there is some sort of problem that is it does not exist. Could you please check link or whther you might have deleted files by accident.
Also I would like to point out that AJAX is in fact advancment on Javascript used to reload parts of the web page so that your user doesn't have to reload all and every single part of web page after doing certain adjustments but he or she will reloadjust the needed part. And I strongly suggest you to use it on your web sites. |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 29th August 2008 - 11:41 PM |