 Programming

### Question Description

I need an explanation for this Programming question to help me study.

how we can add two numbers in php is it same like html/javascript? Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service. 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.

Problem:

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.

Code:

`<html><head><title>Title goes here</title></head><body><formaction=""method="post"><label>Enter Num1:</label><inputtype="text"name="num1"/><br><label>Enter Num2:</label><inputtype="text"name="num2"/><br><br><inputtype="submit"name="btn_submit"value="Add"></form><?phpif(isset(\$_POST['btn_submit'])){\$num1=\$_POST['num1'];\$num2=\$_POST['num2'];\$total=\$num1+\$num2;echo"The total value is: ".\$total;}?></body></html>`

Explanation:

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. UCLA Anonymous
Top quality work from this tutor! I’ll be back! Anonymous
It’s my second time using SP and the work has been great back to back :) The one and only resource on the Interwebs for the work that needs to be done! Anonymous
Thanks, good work Studypool 4.7 Trustpilot 4.5 Sitejabber 4.4 Brown University

1271 Tutors California Institute of Technology

2131 Tutors Carnegie Mellon University

982 Tutors Columbia University

1256 Tutors Dartmouth University

2113 Tutors Emory University

2279 Tutors Harvard University

599 Tutors Massachusetts Institute of Technology

2319 Tutors New York University

1645 Tutors Notre Dam University

1911 Tutors Oklahoma University

2122 Tutors Pennsylvania State University

932 Tutors Princeton University

1211 Tutors Stanford University

983 Tutors University of California

1282 Tutors Oxford University

123 Tutors Yale University

2325 Tutors