1

我想总结结果 1 和结果 2 我该怎么做请帮我解决这个问题

谢谢


示例:$res + res1 =最终结果

这是结果 1 代码

<?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
    ?>

这是第二个结果代码

<?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
?>
4

1 回答 1

4

尝试这个

<?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
    ?>
于 2013-11-13T05:17:18.390 回答