simple form in html using php | Class Assignment

if (isset ($_POST["submit"])){
  $name = $_POST["name"];
  $fatherName = $_POST["fname"];
  $Dob = $_POST["date"];
  $eml = $_POST["email"];

  echo "name is: $name, <br>".
  " Father name is: $fatherName, <br>".
  "Date of birth is: $Dob <br>".
  "Email is: $eml";

<!DOCTYPE html>
<html lang="en" dir="ltr">
    <meta charset="utf-8">
    <title>Email function</title>
    <form class="" action="" method="post">
      <label for="">Name:</label>
      <input type="text" name="name" value="" placeholder="Enter your name">
      <label for="">Father Name:</label>
      <input type="text" name="fname" value="" placeholder="Enter your Fathe Name">
      <label for="">Date of birth:</label>
      <input type="date" name="date" value="">
      <label for="">Email:</label>
      <input type="email" name="email" value="" placeholder="Enter your email">
      <input type="submit" name="submit" value="submit">

Copy this whole code from here and paste it in your editor (Notepad ++, sublime text, Atom, Bracket etc), and save this file as “abc.php” and keep that file inside your htdocs directory, Now run it and accept data from user and displayed it on the top. 

Share it in your network:

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.



You have successfully subscribed to my email list. Now you will be recieving latest wordpress tips and tricks directly in your mail box.

Don’t worry! I won’t spam you