Jump to content
xisto Community
tdktank59

Double Dropdown Disable the second until first is selected

Recommended Posts

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)

<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://forums.xisto.com/no_longer_exists/

Share this post


Link to post
Share on other sites

You need this code:

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


Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.