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

how to get input in php?

24th Aug 2019, 5:56 PM
sujay simha
sujay simha - avatar
2 Answers
+ 4
thanks a lot Abhishek Jain
25th Aug 2019, 7:43 AM
sujay simha
sujay simha - avatar
+ 3
Using $_POST or $_GET superglobals to retrieve the value of the input tag via the name of the HTML tag. For Example, change the method in your form and then echo out the value by the name of the input: Using $_GET method: <form name="form" action="" method="get"> <input type="text" name="subject"> </form> To show the value: <?php echo $_GET['subject']; ?> Using $_POST method: <form name="form" action="" method="post"> <input type="text" name="subject"> </form> To show the value: <?php echo $_POST['subject']; ?>
25th Aug 2019, 4:33 AM
Prathvi
Prathvi - avatar