I want to show error message when return value is null.
this is my form page where i submit lrno.
index.html
<form method="post" name="myForm" action="tracking.php">
<input type="text" name="number" id="number" placeholder="Enter LR Number"
required>
<input type="submit" name="submit" value="Go">
</form>
this is my bind page where i bind data related to lrno
tracking.php
<?php
$number = $_REQUEST['number'];
$data=file_get_contents('http://apis.sd/api/Get_Loadsheet_Details/'.$number);
$datas = json_decode($data);
if($datas == "")
{
$msg = "No data avialable.";
}
?>
<input type="text" name="cmpname" value="<?php echo $datas[0]->COMPANY_NAME?>"/>
<span>
<?php if(isset($msg ))
echo $msg ;
?>
</span>
here when i submit the form it goes to tracking.php but error message not show if submited lrno no avialable in database but if i refresh tracking.php again it shows an error message.