<?php
$id1 = $_GET['id1'];
$date = $_GET['date'];
$sql = "INSERT INTO test(id1, date)
VALUES ('$id1','$date')";
?>
<form action='script.php' method='get'>
<input type='text' name='id1'>
<input type='text' name='date'>
<input type='submit' value='Submit'>
</form>
<button onclick="doRequest()">кнопка</button>
function doRequest(){
$.post('myPhpFile.php', {
action: 'doFunctionOnServer'
}, function(data){
});
}
if($_POST['action'] && $_POST['action'] === 'doFunctionOnServer'){
$sql = "INSERT INTO test(id1, date)
VALUES ('$id1','$date')";
}