0

How do you make user input a variable in php?

20th Jul 2016, 6:28 AM
Jason Mace
8 ответов
+ 1
suppose you are using post method to provide user input , thn you will store it in varibles like this $variablename=$_POST ['input'];
20th Jul 2016, 6:34 AM
sapna
+ 1
normally php is called from a Web page and is used to elaborate and print out the result. usually you pass variables with html form in get or post method, and u receive with $_GET["name"] or $_POST["name"]
21st Jul 2016, 4:29 AM
Diego Zabot
Diego Zabot - avatar
+ 1
If you are using php cli then you can use stdin to take user Input
21st Jul 2016, 8:21 PM
Mrityunjay Yadav
Mrityunjay Yadav - avatar
+ 1
It's very easy, in your user input page inside form you need to write code 👉 <input type="text" name="name"> and then you have to call your PHP script and in that you need to write code 👉 $name = $_POST["name"]; so that the name input by user will now stored in $name variable, you can check this by simply echo this , echo $name;
26th Jul 2016, 8:26 AM
abhijit kumbhar
abhijit kumbhar - avatar
0
$_POST["input"]; 😉
20th Jul 2016, 7:38 AM
GlennV
0
Get value from html page
23rd Jul 2016, 4:38 AM
sandeep singh narya
sandeep singh narya - avatar
0
create a file index.php, paste the below code inside it and run it using xamp or wamp code. <!DOCTYPE html> <html> <body> <form method="post" action="#"> First name:<br> <input type="text" name="firstname"> <br> Last name:<br> <input type="text" name="lastname"> </form> <?php //Here is the php code to store the user input to the variable $firstname=$_POST['firstname']; $lastname=$_POST['lastname']; $fullname = "$firstname"." "."$lastname";//concatination with a space in between echo $fullname; ?> </body>
4th Aug 2016, 3:58 AM
nandul das
nandul das - avatar
- 2
you must use mysql
20th Jul 2016, 5:31 PM
Rasool Vaezi
Rasool Vaezi - avatar