two dropdown box one is parent one is child
Posted: Sat Nov 30, 2013 10:15 am
I wand two drop down box , parent one is state , the child one is city , when state get select the relate city get display. how to do it 
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
:?
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
</script>
<script>
$(document).ready(function(){
$('#bonus').change(function() {
alert($("#bonus option:selected").text());
});
});
</script>
</head>
<body>
<select id="bonus">
<option value="1">-$5000</option>
<option value="2">-$2500</option>
<option value="3">$0</option>
<option value="4">$1</option>
<option value="5">We really appreciate your work</option>
</select>
</body>
</html>Code: Select all
if(country != '')
{
$.ajax
({
type: "POST",
url: "test/useraccount.php",
data: "p="+ country,
success: function(option)
{
$("#institution").html(option);
}
});
}
else
{
$("#institution").html("<option value=''>-- No category selected --</option>");
}
<div>
<table width="100%">
<tr>
<td class="programTitleLeft">Create account</td>
<td class="programTitleRight">hello </td>
</tr>
</table>
<table align=center width=50% border=0 cellpadding=2 cellspacing=0>
<tr><td><b>E-mail address : <b></td>
<td><input type=text name="email" value="" size=40 maxlength=40>
</tr>
<tr><td><b>Country:</b></td>
<td><select id="country" >
<option>---</option>
</select>
</td>
</tr>
<tr><td><b>Institution:</b></td>
<td><select id="institution">
<option >----</option>
</select></td>
</tr>
<tr><td><b>Counselor’s Name : <b></td>
<td><input type=text name="name" value="" size=40 maxlength=40>
</tr>
</table>
</form>
</div>