+ 5
how to get input in php?
2 ответов
+ 4
thanks a lot Abhishek Jain
+ 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']; ?>