You can use $_GET and $_POST globals to get form data to your PHP code

PHP - A Simple HTML Form


<form action="welcome.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">


In the HTML form, you have the action attribute which can be used to specify where you should pass your data.

In our example you pass data to the post.php file, you can use the $_POST to get the form field data.