+ 1
How to accept input from user in php and javascript?
3 Respuestas
+ 4
In javaScript: prompt();
In PHP: fgets(STDN);
+ 2
PHP is server-side lang while js is a client side. PHP handle content passed to the server while js deals with dom object on the client side there is no significance of taking inputs from the user.
There are still methods to take input
In PHP : readline()
Php manual :
https://www.php.net/manual/en/function.readline.php
In js: prompt()
W3:
https://www.w3schools.com/jsref/met_win_prompt.asp
Rather than using this why don't you use an HTML form to take input and then handle it with PHP or js?
0
I'm not sure creating input from JavaScript is the most effective way to do it, but you can create and input element using JavaScript:
document.createElement("input")
With PHP you can write HTML, so just make an input the normal way:
<input />