如何使用php $ _post求和两个结果

i want to sum of result 1 and result 2 how can i do it please help me to fix this issue

thanks


example: $res + res1 =final result

this is result 1 code

<?php //Starting of php 
    if(isset($_POST['submit']))//if the submit button has pressed
    {
    $first = $_POST['first']; //Getting Value of first integer from add.html
    $sec = $_POST['sec']; //Getting Value of Second integer from add.html
    $res = $first * $sec *75 /365 /30; //Adding the two values and placing the added result to 'res' variable
    echo 'Added Result:';

    echo number_format((round($res, 1)),3);


    }
    //Ending of php
    ?>

and this is 2nd result code

<?php //Starting of php 
if(isset($_POST['submit']))//if the submit button has pressed
{
$days1 = $_POST['days1']; //Getting Value of first integer from add.html
$year1 = $_POST['year1']; //Getting Value of Second integer from add.html
$res1 = $days1 * $year1 *75 /365 /30; //Adding the two values and placing the added result to 'res' variable
echo 'Added Result:';

echo number_format((round($res1, 1)),3);


}
//Ending of php
?>

Try this

<?php //Starting of php 
    if(isset($_POST['submit']))//if the submit button has pressed
    {
    $first = $_POST['first']; //Getting Value of first integer from add.html
    $sec = $_POST['sec']; //Getting Value of Second integer from add.html
    $days1 = $_POST['days1']; //Getting Value of first integer from add.html
    $year1 = $_POST['year1']; //Getting Value of Second integer from add.html
    $res1 = $days1 * $year1 *75 /365 /30; //Adding the two values and placing the added result to 'res' variable    
    $res = $first * $sec *75 /365 /30; //Adding the two values and placing the added result to 'res' variable
    $result1  = number_format((round($res1, 1)),3);
        echo 'Added Result:';

    $result2 = number_format((round($res, 1)),3);
    echo $final_result   = number_format(($result1 +$result2),3);

    }
    //Ending of php
    ?>