php - USING if statement do not work as it should -


i have if statment used in code logic of code not work should want when user enter city name without entering district name system must display error message

and when user enter city name , district name without entering lat , long system must display error message .

what hapen in code if user enter city , lat long system display error message inform user enter lat , long

code:

if($_post['city']) {     $city = $_post['city'];     $lat = $_post['lat'];     $long = $_post['long'];      if($_post['dist'] =="")     {         $errormsg = "you can not add city without having relation district";     }     if($lat || $long ==""){ $errormsg = "you can not add village without coordination";}     else     {         $sql = mysql_query("insert village (id, village_name, district_id, lattitude, longitude)values('', '$city', , '$lat',  '$long')")or die(mysql_error());         echo $city;     } } 

if($lat || $long =="") should if($lat=="" || $long =="")


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -