I am going to describe here how to add two numbers using PHP. For this you should have  little bit knowledge of PHP and Jquery. Do following steps:

  1. Create a php page sum.php
  2. You need to make html form
  3. Add jquery library file on the top of the page

Complete code is below:

<script src=”https://code.jquery.com/jquery-1.11.3.js”></script>
var num1 = $(“#first”).val();
var num2 = $(“#second”).val();

<table width=”50%” border=”0″>
<td><input type=”number” id=”first”></td>
<td><input type=”number” id=”second”></td>
<td><input type=”button” id=”Save” value=”Submit”></td>


4. Now create a php page for processing name as process.php

5. write the php code for adding two numbers as below

Code is:

if(isset($_POST[‘num1’]) && $_POST[‘num2’]){
echo $_POST[‘num1’] + $_POST[‘num2’];

6. Now run your file and see the result