PHP insert into query not sending anything to database, maybe because it's inside Javascript function, i don't know yet.. Anyone could help please? thanks.
<script>
function getMeta(){   
    var img = new Image();
    img.onload = function(){
        if (this.width != 468 && this.height != 60)
    {alert( 'Error : only these image sizes are accepted : 468x60' );
    return false;}
    
    else
    alert( 'loaded successfully' );
    document.getElementById('form1').submit();
    <?php
            include("connection.php");
            $email=$_POST["t1"];
            $email=addslashes($email);
         $img=$_POST["t2"];
         $img=addslashes($img);
         $target=$_POST["t3"];
         $target=addslashes($target);
  
            $sql=mysql_query("insert into b1(email, img, target) values  ('$email', '$img', '$target')");
   
?>
    };
 img.onerror = function() {alert( 'Error : this is not a valid image');
 return false;
  };
    img.src = document.getElementById('t2').value;
 return true;
}
</script>