I have below code to get the country and state details from the database. My issue is it should automatically select India and the state karnataka in the form. I have attached the screenshot for reference. While accessing form I should see Country as India and State as Karnataka. How this can be achieved?
$con_sql ="SELECT a.`id_country`, b.`name` AS `name`, `iso_code`, `call_prefix`, z.`id_zone` AS `zone`, a.`active` AS `active`
, z.`name` AS zone FROM `country` a
LEFT JOIN `country_lang` b ON (b.`id_country` = a.`id_country` AND b.`id_lang` = 1)
LEFT JOIN `zone` z ON (z.`id_zone` = a.`id_zone`)
WHERE 1 ORDER BY b.`name` ASC";
$con_res = mysqli_query($con, $con_sql);
if($con_res !== null){
while($row = mysqli_fetch_array($con_res))
{ echo '';
}} else { echo '';
}?>
No comments:
Post a Comment