<html>
<header>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
<title> 線形予測ツール </title>
</header>
<body bgcolor="#e0f0ff">
<?php
    $datetime1_str 
= @$_REQUEST['datetime1'];
    
$datetime2_str = @$_REQUEST['datetime2'];
    
$datetime1 strtotime($datetime1_str);
    
$datetime2 strtotime($datetime2_str);
    
$amount1 = @$_REQUEST['amount1'];
    
$amount2 = @$_REQUEST['amount2'];
    
$amount3 = @$_REQUEST['amount3'];
//
    
$datetime1_str htmlspecialchars($datetime1_str);
    
$datetime2_str htmlspecialchars($datetime2_str);
    
$amount1_str htmlspecialchars($amount1);
    
$amount2_str htmlspecialchars($amount2);
    
$amount3_str htmlspecialchars($amount3);
?>

<form>
1: <input type="text" name="datetime1" value="<?php echo $datetime1_str ?>"> :  <input type="text" name="amount1" value="<?php echo $amount1_str ?>">
<br />
2: <input type="text" name="datetime2" value="<?php echo $datetime2_str ?>"> :  <input type="text" name="amount2" value="<?php echo $amount2_str ?>">
<br />
3: YYYY-mm-dd HH:ii:ss : <input type="text" name="amount3" value="<?php echo $amount3_str ?>"> <input type="submit">
</form>

<?php
if (($datetime1_str !== '') &&  ($datetime2_str !== '') &&
    (
$amount1 !== '') && ($amount2 !== '') && ($amount3 !== '')) {
    
$datetime3 $datetime1 + ($amount3 $amount1)/($amount2 $amount1) * ($datetime2 $datetime1);
    echo 
"YYYY-mm-dd HH:ii:ss = ".date('Y-m-d H:i:s'$datetime3)."<br />\n";
}
?>

</body>
</html>