Hi, Sir
Please Resolve the code
How to selected item change function with database in php.
First_page-: index.php
Drop_Down - action="" name="form1">
Drop Down Select Item Change
"45%" cellspacing="0" cellpadding="0">
"175">Country "150">: "150"> - onChange="getState(this.value)">
- >Select Country
- while ($row=mysql_fetch_array($result)) { ?>
- ]?>>'country']?>
State "50">: "statediv">- >
City "50">: "citydiv">- >
- "submit" name="submit"/>
Second:-findcity.php
- $countryId = intval($_GET['country']);
- $stateId = intval($_GET['state']);
- $con = mysql_connect('localhost', 'root', '','test');
- if (!$con) {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db('test');
- $query="SELECT id,city FROM city WHERE countryid='$countryId' AND stateid='$stateId'";
- $result=mysql_query($query);
- ?>
- >
- while($row=mysql_fetch_array($result)) { ?>
- $row['id']?>>echo $row['city']?>
- Thirdpage:-findstate.php
- $country = intval($_GET['country']);
- $con = mysql_connect('localhost', 'root', '','test');
- if (!$con) {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db('test');
- $query = "SELECT id,statename FROM state WHERE countryid='$country'";
- $result = mysql_query($query);
- ?>
- onchange="getCity(,this.value)">
- while ($row=mysql_fetch_array($result)) { ?>
- $row['id']?>>echo $row['statename']?>
I have attach the all code
Thanks
(Kishan)

Replies
Know the answer? Post it — somebody with the same question will find it here.