Skip to content
PHP Logo

How can the action attribute in a form tag be used to link a PHP file to an HTML file for data processing?

To link a PHP file to an HTML file for data processing, you can use the action attribute in the form tag. This attribute specifies the URL of the file that will process the form data. By setting the action attribute to the PHP file, the form data will be sent to the PHP file for processing.

php
<form action="process.php" method="post">
  <!-- form fields go here -->
  <input type="submit" value="Submit">
</form>