Breaking

LightBlog

Friday 6 March 2015

Sum of Two Number without using + in PHP


Get the from users in first text Box and second text box.
In for loop number of condition is defined till first number and increment the second number one by one till the condition.
We have require the two files first design file and second is PHP file 
                                     
sum of two no without +
First file name such as First.php.
<html>
<head>
<title>sum of two number without + operator in PHP</title>
</head>
<style>
input{
height:30px;
width:200px;
}

</style>
<body>
<form action="sec.php" method="post">
<table bgcolor="#FF6600" align="center" width="400" border="1">
<tr>
<td width="121">First Value </td>
<td width="63"><label> 
<input name="first" type="text" id="first" />
</label></td>
</tr>
<tr>
<td>Second Value </td>
 <td><label>
 <input name="sec" type="text" id="sec" />
 </label></td>
</tr>
<tr>
<td><label>
<input name="add" type="submit" id="add" value="+" />
</label></td>
</tr>
</table>
</form>
</body>
</html>

Second File is save sec.php

<?php
if(isset($_REQUEST['add']))
{
$first=$_REQUEST['first'];
$sec=$_REQUEST['sec'];
for($i=0;$i<$first;$i++)
{
$sec++;
}
echo "<font color='green'>sum of two no is =".$sec."</font>";
}
?>
Output:
                            
                                

Here Video Tutorial
                              


Adbox