

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    // <link rel="stylesheet" href="table.css">
    <link rel="stylesheet" href="main12.css">
    <link rel="stylesheet" href="includes/form.css">

    <meta charset="utf-8">
    <title>Attendnace Taking</title>
    

    <link rel="stylesheet" href="includes/time.css">
    <link rel="stylesheet" href="includes/main12.css">

    <script type="text/javascript">

function SetDate()
{
var date = new Date();

var day = date.getDate();
var month = date.getMonth() + 1;
var year = date.getFullYear();

if (month < 10) month = "0" + month;
if (day < 10) day = "0" + day;

var today = year + "-" + month + "-" + day;


document.getElementById('theDate').value = today;
}
</script>



  </head>
  <body onload= SetDate()>


<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
  require "../includes/db.php";

  $sql = "INSERT INTO guest(GuestFirstName, GuestLastName, GuestPhoneNumber, GuestEmail, GuestDate)
          VALUES ('" . mysqli_escape_string($con, $_POST['GuestFirstName']) . "', '"
                      . mysqli_escape_string($con, $_POST['GuestLastName']) . "', '"
                      . mysqli_escape_string($con, $_POST['GuestPhoneNumber']) . "', '"
                      . mysqli_escape_string($con, $_POST['GuestEmail']) . "', '"
                     . mysqli_escape_string($con, $_POST['GuestDate']) . "')";

  $results= mysqli_query($con, $sql);

  if ($results === false) {
    echo mysqli_error($con);
  } else {
    $id = mysqli_insert_id($con);
    echo "Insert record with $id";

  }

}
 ?>
 <?php require '../frontpage/header.php' ?>
<section>
  <div class="field">
    <h2>Add New Guest</h2>
  </div>

  <div class="formmain">
    <form  method="post">
      <div class="field12">
       <p><label for="GuestFirstName">Enter First Name :</label></p>
      <p><input type="text" name="GuestFirstName" id="GuestFirstName"></p>
      </div>

      <div class="field12">
        <p><label for="GuestLastName">Enter Last Name :</label></p>
      <p><input type="text" name="GuestLastName" id="GuestLastName"></p>
      </div>

      <div class="field12">
        <p><label for="GuestEmail">Enter Email:</label></p>
      <p><input type="text" name="GuestEmail" id="GuestEmail"></p>
      </div>

      <div class="field12">
        <p><label for="GuestPhoneNumber">Enter Phone Number :</label></p>
      <p><input type="text" name="GuestPhoneNumber" id="GuestPhoneNumber"></p>
      </div>

      <div class="field12">
        <p><label for="GuestDate">Enter Date :</label></p>
      <p><input type="date" name="GuestDate" id="theDate" ></p>
      </div>
      <div class="field12">

        <p><button class="button"> Submit </button></P>
        </div>

    </form>
  </div>

  <!-- <a href="#" onClick="MyWindow=window.open('http://www.google.com','MyWindow','width=600,height=300'); return false;">Click Here</a> -->


</section>
<?php require '../includes/footer.php' ?>

</body>
</html>
