Could somebody create a simple addition calculator ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Could somebody create a simple addition calculator ?

14th Jan 2023, 7:09 PM
Andres
Andres - avatar
4 Answers
+ 2
PHP is a server side scripting language. To take input you would need to use something else to take the input (unless you were inputting directly into the console, then you could use readline). Theres a few ways you could take input from a user, probably the easiest would be to use a html form, with a few inputs. PHP can use the variables from get/postā€¦ Google html/php forms and youā€™ll find lots of simple examples. šŸ‘
15th Jan 2023, 12:59 AM
DavX
DavX - avatar
+ 1
This script creates an HTML form with two input fields for the numbers to be added and a submit button. When the submit button is pressed, the form data is posted to the PHP script, which then retrieves the values of the input fields, adds them together, and outputs the result. https://code.sololearn.com/wT2ag6nMuTGA/?ref=app You would need a PHP server to run this code, since Code Playground can't perform web redirection.
15th Jan 2023, 6:27 AM
CalviÕ²
CalviÕ² - avatar
0
Can I see your code?
14th Jan 2023, 7:31 PM
Knight
Knight - avatar
0
I'm a beginner so , I tried to do this: https://code.sololearn.com/wP5j0v7FFElH/?ref=app But what I what is to Do A addition calculator , that ask me : "write the first number" next "write the second number " and finally :" the result is :
14th Jan 2023, 7:58 PM
Andres
Andres - avatar