User Input In PHP | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

User Input In PHP

How to get user input in PHP is it possible to get user input? If PHP has no user input then how does it process data?

6th Oct 2017, 6:38 PM
Aditya
Aditya - avatar
8 Answers
+ 5
all the inputs (data) comes in PHP from html webpages, for input , you need to use form in html document ,And in that form , you need an action and a method. then in PHP you get all the inputs using super variable $_POST OR $_GET and save in normal variable and process it as normal
9th Oct 2017, 9:35 AM
Kuldeep Kumar
Kuldeep Kumar - avatar
+ 4
It Only Displays In the Webpage
6th Oct 2017, 6:45 PM
Abhay Kumar Singh
Abhay Kumar Singh - avatar
+ 3
I Don't Think So. I Have Just Completed The PHP Course, I Didn't Found it Anywhere 😕😕😕
6th Oct 2017, 6:42 PM
Abhay Kumar Singh
Abhay Kumar Singh - avatar
+ 3
ok...Andrew I got it
6th Oct 2017, 6:45 PM
Aditya
Aditya - avatar
+ 2
Do you mean forms? Or input like the user click a key on their keyboard? If it is from a form, you can definitely do it in php. Though to do client side interactions you need JavaScript. JavaScript can listen for key presses in the client browser.
6th Oct 2017, 6:43 PM
Microhacker
Microhacker - avatar
+ 2
I too think the same.....but then how PHP process data if it has no inputs?
6th Oct 2017, 6:43 PM
Aditya
Aditya - avatar
+ 2
I ment user input like from keyboard
6th Oct 2017, 6:44 PM
Aditya
Aditya - avatar
+ 1
why don't work "$line = trim(fgets(STDIN));" in sololearn codes? simply the function tell me $line is empty (null), don't allow write ... but in console it's works! what happen?
30th Dec 2018, 12:46 PM
Angel Luis García-Junco Lora
Angel Luis García-Junco Lora - avatar