2013-11-13 3 views
0

я хочу подвести результат 1 и результат 2 как я могу это сделать, пожалуйста, помогите мне решить эту проблему

благодаря


пример: $ разреш + 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 
?> 
+0

Вы говорите * сумма * и то, что вы делаете * $ первыми * $ сек * 75/365/30 * так вопрос неясно –

+0

Являются ли они на одной странице или в разных файлах? – Darren

+0

Почему умножение описывается как «добавление»? – JAL

ответ

3

Попробуйте

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

спасибо zeeshan за понимание ... – msalman

+0

zeeshan может у вас указать свой адрес электронной почты fb? – msalman

+0

вы можете увидеть в моем профиле, если этот ответ поможет вам принять. – Zeeshan

Смежные вопросы