Code For PHP Assignment - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Code For PHP Assignment (1093 Views)
| 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): 5:27pm On Nov 07, 2017*. Modified: 5:43pm 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> |
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
Entrepreneurs In Software Development. • I Want To Learn Advanced Excel • Raspberry Pi Developers