1. Home
  2. Docs
  3. Web Technology II
  4. File and Form Handling
  5. Building Forms in PHP

Building Forms in PHP

Forms are an essential way to collect data from users. HTML forms use GET or POST methods to submit data to PHP scripts for processing.

Simple Form Example

Here’s a basic form where the user submits their name and email.

<!DOCTYPE html>
<html>
<body>

<h2>User Information Form</h2>
<form action="process_form.php" method="POST">
  Name: <input type="text" name="name"><br><br>
  Email: <input type="email" name="email"><br><br>
  <input type="submit" value="Submit">
</form>

</body>
</html>

In this example:

  • action specifies the PHP file to handle the form data.
  • method=”POST” sends data securely without displaying it in the URL.

How can we help?

Leave a Reply

Your email address will not be published. Required fields are marked *