How to get user input in php? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to get user input in php?

25th Feb 2019, 3:12 PM
Archana Nimeshika
Archana Nimeshika - avatar
4 Answers
+ 3
but it cause an error
25th Feb 2019, 3:46 PM
Archana Nimeshika
Archana Nimeshika - avatar
+ 2
Whats the error?
25th Feb 2019, 7:04 PM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
+ 2
From http://php.net/manual/en/function.readline.php : The readline library is not available on Windows. Try: <?php if (PHP_OS == 'WINNT') {   echo '$ ';   $line = stream_get_line(STDIN, 1024, PHP_EOL); } else {   $line = readline('$ '); } ?> Other Solutions at same URL. By the way, SL interpreter runs on Windows Server 2012; as usual, you can get all infoes about PHP environment using phpinfo()
3rd Mar 2019, 2:23 AM
Paolo De Nictolis
Paolo De Nictolis - avatar
+ 2
By the way, you get user input from CLI. For the task Shruthi suggested, use a form and manage $_POST array: https://www.w3schools.com/php/php_forms.asp
3rd Mar 2019, 2:28 AM
Paolo De Nictolis
Paolo De Nictolis - avatar