how to take input from User in PHP ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how to take input from User in PHP ?

27th Sep 2016, 5:14 PM
Sushant Singh
Sushant Singh - avatar
8 Answers
+ 5
in HTML <input type="text" name="user" > in PHP if (isset ($_POST['user'])){ Do this if I sset the user name } else { Do this if I didn't set the user name }
27th Sep 2016, 9:26 PM
Driss Baidou
Driss Baidou - avatar
+ 4
$_GET used to retrieve what icluded in the browser link. example www.sololoearn.com/user.php?name=sushant the PHP will look for the name in the link and will print the name as sushant
27th Sep 2016, 9:30 PM
Driss Baidou
Driss Baidou - avatar
+ 2
Create a HTML form and read the input with $_POST or $_GET
27th Sep 2016, 8:54 PM
Franz Alt
Franz Alt - avatar
+ 1
<?php if(!empty($_POST['input_data']) && isset($_POST['input_data'])){ $variable = $_POST['input_data']; ?>
4th Oct 2016, 5:21 PM
Deepak Singh
Deepak Singh - avatar
0
thanks
27th Sep 2016, 8:55 PM
Sushant Singh
Sushant Singh - avatar
0
how it will work ...in the case of taking values from User and putting it in an Array simultaneously ?
27th Sep 2016, 9:31 PM
Sushant Singh
Sushant Singh - avatar
0
Do you mean inserting the values to database with php ?
27th Sep 2016, 9:55 PM
Driss Baidou
Driss Baidou - avatar
0
i mean to ask the user to enter some thing eg his name, age as its done in java with scanner....
26th Oct 2018, 9:45 PM
Malik Maalik
Malik Maalik - avatar