0
Could somebody create a simple addition calculator ?
4 odpowiedzi
+ 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. 👍
+ 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.
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 :