Unable to save data in database using php : I am using the following code to save data in php. The data I want to save is: 

Latitudes:"[47.99267886541119,47.81223227508317]"

Longitudes:"[19.403228759765625,19.015960693359375]"

Please help me rectifyany error in the code. Thank you.

     <?php
      $con = mysqli_connect('localhost','root','');
    if(!$con)
    {
     echo 'Not Connected To Server';
    }
     if (!mysqli_select_db ($con,'test'))
    {
      echo 'Database Not Selected';
      }
      for ($i=0;$i<count($_POST['Latitudes']);$i=$i+1)
      {
      $Latitude = $_POST['Latitudes'][$i];
       }
        for ($i=0;$i<count($_POST['Longitudes']);$i=$i+1)
       {
        $Longitude= $_POST['Longitudes'][$i];
       }
       $sql = "insert into polyline (lat,lng) values 
          ('$Latitude','$Longitude')";

     if (!mysqli_query($con,$sql))
     {
       echo 'Not Inserted';
      }

     else
      {
        echo 'Inserted Successfully';
      }

       header("refresh:100; url=Final edited copy.html");


      ?>