KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm absolute beginner in web technologies. I know that my question is very simple, but I don't know how to do it. For example I have a function: function addNumbers($firstNumber, $secondNumber) { echo $firstNumber + $secondNumber; } And I have a form: <form action="" method="post"> <p>1-st number: <input type="text" name="number1" /></p> <p>2-nd number: <input type="text" name="number2" /></p> <p><input type="submit"/></p> How can I input variables on my text fields and call my function by button pressing with arguments that I've wrote into text fields? For example I write 5 - first textfield, 10 - second textfield, then I click button and I get the result 15 on the same page. EDITED I've tried to do it so: $num1 = $POST['number1']; $num2 = $POST['number2']; addNumbers($num1, $num2); But it doesn't work, the answer is 0 always.
Tags (comma-separated)
Save Edits
Cancel