PHP task

label Programming
account_circle Unassigned
schedule 1 Day
account_balance_wallet $5

how we can add two numbers in php is it same like html/javascript?

May 10th, 2014

In this tutorial, we will know how to add two numbers using PHP. PHP can also perform arithmetic and can be use to solve mathematical equations. Sample problem is the given problem below which ask the user to input two numbers and get the sum of the two numbers.


Write a program that will ask the user to input to numbers. Then the program must computer the sum of the two numbers and display.


<title>Title goes here</title>

<label>Enter Num1:</label>
<label>Enter Num2:</label>



echo"The total value is: ".$total;



The program allow the user to input two numbers as stated on the problem above. The program provide user to input field which has a name of num1 and num2. When the user click the submit button the program will going to execute the PHP scripts below. PHP script first execute the condition if to determine whether the use had click the button or none. When the condition returns true then the following lines of code will be execute. The value from the form text field that has a name of num1 and num2 will be stored in a temporary variable which is the $num1 and $num2. Then, the next line of code wil be executed in which perform the adding of the two numbers and stored the sum in the variable named $total. To finish with the last line of script will be executed which display the total of the two numbers adn we use the variable total which contains the sum value of the two numbers. Below is the sample output from the given codes above.

May 10th, 2014

Studypool's Notebank makes it easy to buy and sell old notes, study guides, reviews, etc.
Click to visit
The Notebank
May 10th, 2014
May 10th, 2014
Oct 19th, 2017
Mark as Final Answer
Unmark as Final Answer
Final Answer

Secure Information

Content will be erased after question is completed.

Final Answer