php - How to use two isset condition in single page -
how use 2 isset() conditions in same page?
this how code looks:
if (isset($_post["location_from"]) && !empty($_post["location_from"])) { ......... ......... echo json_encode($returnvalues); } if (isset($_post["location_to"]) && !empty($_post["location_to"])) { ......... ......... echo $value; } if (isset($_get["id"]) && !empty($_get["id"])) { ......... ......... echo $value_id; } so in above code when pass value in ajax $_post['location_from'] works perfectly, , when pass value in ajax $_get['id'] works perfectly, when pass value in ajax $_post['location_to'] function inside $_post['location_from '] working , echoing. appreciated.
if want write max 1 value (the first condition met), use elseifs instead of ifs.
if (!empty($_post['location_to'])) { echo ...; } elseif (!empty($_post['location_from'])) { echo ...; } elseif (!empty($_get['id'])) { echo ...; }
Comments
Post a Comment