Double Dropdown - Disable the second until first is selected

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > Java, Java Servlets, Java Script, & JSP

Double Dropdown - Disable the second until first is selected

tdktank59
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

 

 

 


Reply

Stenno
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>"

 

 

 


Reply

hitmanblood
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.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.


*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for double, dropdown, disable, selected

*MORE FROM TRAP17.COM*
advertisement



Double Dropdown - Disable the second until first is selected



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE