₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,324,994 members, 8,419,847 topics. Date: Thursday, 04 June 2026 at 02:39 AM

Toggle theme

Code For PHP Assignment - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingCode For PHP Assignment (1093 Views)

1 Reply (Go Down)

Code For PHP Assignment by sunpumping(op): 2:51pm On Nov 07, 2017
Pls I need a php code for addition of two numbers together. I am to add input tag to it and place holder. Pls help me. Thanks and God bless.
Re: Code For PHP Assignment by Darey00(m):
I only know Javascript ,but you can draw inspiration from this



<form>
<input type = "number" placeholder= "first number">


<input type = "number" id='f' placeholder= "second number">


<input type = "number" id='result' placeholder= "second number">


<input type = "button" id='result' type="submit">
</form>



<script>


function add(){


var firstNumber =
document.getElementById('f').value;



var secondNumber =
document.getElementById('s').value;



var add = first + second;



document.getElementById('result').
INNERHTML = "result is "+ add;



}

document.getElementById('result').addEventListener ('click', add, false);
</script>
Re: Code For PHP Assignment by ANTONINEUTRON(m): 5:31pm On Nov 07, 2017
i don't understand your question that much, but try this.


<!DOCTYPE html>
<html lang="en">
<head>
<title>Untitled</title>
</head>
<body>
<form action='' method='post'>
<input name='first_num' type='text' placeholder='First Number here' />
<input name='second_num' type='text' placeholder='Second Number here' />
<input type='submit' value='Add Number' />
</form>
<?php
if($_SERVER['REQUEST_METHOD']=='POST'){
$sum = $_POST['first_num'] + $_POST['second_num'];
echo $sum;
}
?>
</body>
</html>
Re: Code For PHP Assignment by francollimasso: 11:41pm On Nov 07, 2017
<!DOCTYPE html> <html lang="en"> <head> <title>Untitled</title> </head> <body> <form action='' method='post'> <input name='first_num' type='number' plac <input name='second_num' type='number' plac <input type='submit' value='Add Number' / </form> <?php if($_SERVER['REQUEST_METHOD']=='POST'){ $sum = $_POST['first_num'] + $_POST['sec echo $sum; } ?> </body> </html>
1 Reply

A Thread For PHP Code Igniter Framework TutorialLooking For Php Freelancers To Work On A Big Project With MeSMS Gateway For Php234

Entrepreneurs In Software Development.I Want To Learn Advanced ExcelRaspberry Pi Developers