simple form in html using php | Class Assignment

<?php
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">
  <head>
    <meta charset="utf-8">
    <title>Email function</title>
  </head>
  <body>
    <form class="" action="" method="post">
      <label for="">Name:</label>
      <br>
      <input type="text" name="name" value="" placeholder="Enter your name">
      <br>
      <label for="">Father Name:</label>
      <br>
      <input type="text" name="fname" value="" placeholder="Enter your Fathe Name">
      <br>
      <label for="">Date of birth:</label>
      <br>
      <input type="date" name="date" value="">
      <br>
      <label for="">Email:</label>
      <br>
      <input type="email" name="email" value="" placeholder="Enter your email">
      <br>
      <br>
      <br>
      <input type="submit" name="submit" value="submit">
    </form>
  </body>
</html>

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.

small_c_popup.png

Congratulations!

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