+ 1
What PHP is used for a form in HTML?
I have a couple of forms and search bars on my website that need PHP to be added so they can work, does anyone know what I need to add to make my form and search bars work?
4 Answers
+ 2
see this, and if you have any question you can ask
https://www.sololearn.com/learn/PHP/1840/
+ 2
PHP will use GET and POST to collect the data..PHP is used on backend to work on the data collected.
+ 1
form tag in html and _GET and _POST variables in php.
0
at first your form should have attributes like action, method and enctype.
then each of the input type should have a unique names
ie.
<form action="" method="post"/>
<input type="email" name="email" />
<input type="submit" name="submit" value="subscribe"/>
</form>
then use the value of the name attribute as a php input variable to retrive data from the form.
i.e
<?PHP
extract ($_POST); đ//if method is post use $_GET if method is get
then confirm that submit button clicked like this
if ($submit){
echo $email;
}
?>
to insert in to the data base
use the mysqli query ...