AJAX and Php not keeping values between my drop downs

Fixed the Query

it actually works it gives me Country, State and City. the value is correct but between each dropdowns it still gives
Undefined index: state in C:\xampp\htdocs\loginandout\testandlearnajax2.php on line 5 and
|Undefined index: country in C:\xampp\htdocs\loginandout\testandlearnajax2.php on line 4|

Also not sure how i can fix the matter you raised by saying only one of the two AJAX sends the to my PHP. pretty new to AJAX :(
<?php
include('dbconnection.php');

$country = $_GET["country"];
$state = $_GET["state"];

if($country!=""){

			$sql2 = "select * from states where country_id= '$country'";
			$result2 = mysqli_query($link11,$sql2);

			echo "<select id ='statedd' onChange='change_state()'>";
			
			while($row2=mysqli_fetch_array($result2)){

			echo "<option value= '$row2[id]'>"; echo $row2['name']; echo "</option>";


						}	
	echo "</select>";
		}
?>

<?php
if($state!=""){

			$sql3 = "select * from cities where stateid ='$state'";

			$result3 = mysqli_query($link11,$sql3);

			echo "<select id ='statedd' onChange='change_state()'>";

			while($row3=mysqli_fetch_array($result3)){

			echo "<option value= '$row3[id]'>"; echo $row3['name']; echo "</option>";


						}
		echo "</select>";
		}
?>