It's free and you have access to premium codes!
Welcome back! Please login to your account.
Don't worry, we'll send you a message to help you to recover your acount.
Please check your email for instructions to activate your account.
Written by 19 March 2013
Adding two numbers and return the result.
<!-- this script is provided by https://www.phpfreecode.com coded by: Kerixa Inc. -->
<html>
<head>
<style type="text/css">
#add{margin-left:200px;}
#tit{color:red;margin-left:50px;margin-top:20px;font-family:Arial;font-size:30px;}
.num{font-family:Budoni;color:green;}
#res{color:blue;font-family:Sans-serif;margin-left:50px;}
#result{color:red;width:70px;}
</style>
</head>
<body>
<?php
$num1="0";
$num2="0";
$res="0";
if(!empty($_POST["num1"]) && !empty($_POST["num2"]) ){
$num1=$_POST["num1"];
$num2=$_POST["num2"];
$res=$num1+$num2;
}
?>
<form method="post">
<label id="tit">| Adding Two numbers using php Function |</label>
<br/><br/>
<label class="num">Input 1st number : <input type="text" name="num1" value="<?php echo $num1; ?>";/></label><br/><br/>
<label class="num">Input 2nd number : <input type="text" name="num2" value="<?php echo $num2; ?>" /></label>
<br/><br/>
<input type="submit" value="ADD" id="add"/>
<input type="reset" value="reset">
</form>
<label id="res">RESULT : <input type="text" value="<?php echo $res; ?>" disabled="yes" id="result" /></label>
</body>
</html><a target='_blank' href='https://www.phpfreecode.com' style='font-size: 8pt; text-decoration: none'>Php Best Codes</a>
Comments
Here you can leave us commments. Let us know what you think about this code tutorial!