For selecting country in drop down list
The states are also filled auto matically from the database table as shown in the above figure.
<html>
<head>
<title>Fill Dropdown list</title>
<script language="javascript" type="text/javascript">
function showState(Country_Id)
{
document.frm.submit();
}
</script>
</head>
<body>
<form name="frm" id="frm">
<?php
$con=mysqli_connect(@"localhost", "root", "","demo") or die("Connection Failed");
$query = "SELECT * FROM tbl_country";
$result = mysqli_query($con,$query);
?>
<select name="select1" onChange="showState(this.value);">
<option value="">--- Select Country---</option>
<?php
while ($line = mysqli_fetch_array($result)) {
?>
<option value="<?php echo $line['id'];?>" <?php if($line['id']==$_REQUEST["select1"]) { echo
"Selected"; } ?> > <?php echo $line['countryname'];?> </option>
<?php
}
?>
<?php
$con=mysqli_connect(@"localhost", "root", "","demo") or die("Connection Failed");
$query = "SELECT * FROM tbl_state where cid='$_REQUEST[select1]'";
$result = mysqli_query($con,$query);
?>
</select>
<select name="select2" >
<option value="">--- Select State---</option>
<?php
while ($line = mysqli_fetch_array($result)) {
?>
<option value="<?php echo $line['sid'];?>"> <?php echo $line['statename'];?> </option>
<?php
}
?>
</select>
</form>
</body>
</html>
For Learn Project Training with PHP Technologies
Visit Website : PHP Project Training Institute Vadodara, Gujarat, India.
The states are also filled auto matically from the database table as shown in the above figure.
<html>
<head>
<title>Fill Dropdown list</title>
<script language="javascript" type="text/javascript">
function showState(Country_Id)
{
document.frm.submit();
}
</script>
</head>
<body>
<form name="frm" id="frm">
<?php
$con=mysqli_connect(@"localhost", "root", "","demo") or die("Connection Failed");
$query = "SELECT * FROM tbl_country";
$result = mysqli_query($con,$query);
?>
<select name="select1" onChange="showState(this.value);">
<option value="">--- Select Country---</option>
<?php
while ($line = mysqli_fetch_array($result)) {
?>
<option value="<?php echo $line['id'];?>" <?php if($line['id']==$_REQUEST["select1"]) { echo
"Selected"; } ?> > <?php echo $line['countryname'];?> </option>
<?php
}
?>
<?php
$con=mysqli_connect(@"localhost", "root", "","demo") or die("Connection Failed");
$query = "SELECT * FROM tbl_state where cid='$_REQUEST[select1]'";
$result = mysqli_query($con,$query);
?>
</select>
<select name="select2" >
<option value="">--- Select State---</option>
<?php
while ($line = mysqli_fetch_array($result)) {
?>
<option value="<?php echo $line['sid'];?>"> <?php echo $line['statename'];?> </option>
<?php
}
?>
</select>
</form>
</body>
</html>
For Learn Project Training with PHP Technologies
Visit Website : PHP Project Training Institute Vadodara, Gujarat, India.
can you send the code with database file.
ReplyDeleteYes,
DeleteGive me Your Email Id.
ankur.akku@gmail.com
DeletePlz send the code with database file.(nikhilkamble2009@gmail.com)
ReplyDeleteplease send this code to me also...
ReplyDeletehbtarkel94@hotmail.com
me too : niralshah.251@gmail.com
ReplyDeleteme too, hemanth.greenfish@gmail.com
ReplyDeleteme too: nadav@comepdia.net
ReplyDeletecan you send the code with database file
ReplyDeleteMail id gnanashankar91@gmail.com
Deletehi, can I also ask for the dBase file? thank you
ReplyDeleteplease send in my email jcsalegre@gmail.com
Deletemayanksinghchauhan18@gmail.com
ReplyDeletesend the code with database
please send the code to this email id
ReplyDeletedanishkhan989@gmail.com
send me
ReplyDeleterahul.laabhaa@gmail.com
Sir,
ReplyDeleteCan you please send me the source code in the given email id
shanawaj@gmail.com
Thanks in Advance.
Computer Training Institute Vadodara. Java, Advanced Java, Android, ASP.Net, PHP, CMS, SEO, Project Training, Oracle, SQL Server, MySQL, Data Structures, Algorithms, System Programming, DBMS, OS, C, C++ Programming, HTML, CSS, Web Design, JavaScript, JQuery, AJAX, etc.
More Details Visit : http://www.vataliyatuitionclasses.com
plz send mi code n db file
ReplyDeleteid
pnsonawane11@gmail.com
Can you please send code and database. I notice this is country/state drop downs. Will you include cities drop down. Select country from drop down, on select state in 2nd drop down then on select cities in 3rd drop down.
ReplyDeleteCan you please send code and database. I notice this is country/state drop downs. Will you include cities drop down. Select country from drop down, on select state in 2nd drop down then on select cities in 3rd drop down.
ReplyDeleteCan you please send code and database. I notice this is country/state drop downs. Will you include cities drop down. Select country from drop down, on select state in 2nd drop down then on select cities in 3rd drop down.
ReplyDeletecode is working fine but it clears all the textbox and dropdown to default value on the existing page where i am using this..
ReplyDeleteAdmin please help me with the issue..
Pls send me full code with all files at pkhushboo16@gmail.com
ReplyDeleteple send me a complete source code at panneerrathinam@gmail.com
ReplyDelete