<?php
//for whatsapp enquiry
date_default_timezone_set('Asia/Kolkata');
$enq_date = date('Y-m-d H:i:s');
$referer = $_SERVER['HTTP_REFERER'];
$ip=$_SERVER['REMOTE_ADDR'];
$admin_sql1 = mysqli_query($GLOBALS['dbcon'], "select * from admin_details");
$admin_res1 = mysqli_fetch_array($admin_sql1);
$re_mobile = $admin_res1['whatsapp_no'];
if(isset($_POST['submit']))
{
   $w_name = $_POST['wname'];
   $w_mobile = $_POST['wmobile'];

   $sql_w = mysqli_query($GLOBALS['dbcon'],"insert into tbl_enquiry (en_name,en_mobile) VALUES ('$w_name','$w_mobile')");
   if($sql_w)
   {
?>
       <script>
           var re_mo = '<?php echo $re_mobile;?>'
           var url = 'https://api.whatsapp.com/send/?phone='+re_mo+'&text=Thank you for Enquiry with prime machinery';
           let newTab = window.open();
           newTab.location.href = url;
        </script>

        <?php
   }
}

?>