Friday, 23 June 2017

mysql - Automatic selection of form data in dropdown

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 '';


}?>








* State


No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...