Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,195,102 members, 7,957,113 topics. Date: Tuesday, 24 September 2024 at 07:22 AM |
Nairaland Forum / Science/Technology / Programming / Code For PHP Assignment (1045 Views)
A Thread For PHP Code Igniter Framework Tutorial / Looking For Php Freelancers To Work On A Big Project With Me / SMS Gateway For Php (2) (3) (4)
Code For PHP Assignment by sunpumping: 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): 5:27pm On Nov 07, 2017 |
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.
|
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)
Ethical Hacking 2017 / Meet Sophia The Humanoid (robot) / The Official Method On How To Download Official Windows 8.1 ISO With Ease.
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 12 |