Jump to content

watsonjohn

New Members
  • Posts

    1
  • Joined

  • Last visited

watsonjohn's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. personcreate.php <?php session_start(); ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Bootstrap demo</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous"> </head> <body> <div class="container"> <?php include('message.php'); ?> <div class="row"> <div class="col-md-12"> <div class="class"> <div class="class-header"> <h3> Add Info <a href="index.php" class="btn btn-danger float-end">Back</a> </h3> </div> <div class="card-body"> <form action="infoconn.php" method="POST"> <div class="mb-3"> <label>First name</label> <input type="text" firstname="firstname" class="form-control"> </div> <div class="mb-3"> <label>Last name</label> <input type="text" lastname="lastname" class="form-control"> </div> <div class="mb-3"> <label>Date Registered</label> <input type="date" datereg="datereg" class="form-control"> </div> <div class="mb-3"> <label>Address</label> <input type="text" address="address" class="form-control"> </div> <div class="mb-3"> <label>Phone</label> <input type="text" phone="phone" class="form-control"> </div> <div class="mb-3"> <label>Email</label> <input type="email" email="email" class="form-control"> </div> <div class="mb-3"> <button type="submit" name="save_info" class="btn btn-primary">Save Info</button> </div> </form> </div> </div> </div> </div> </div> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script> </body> </html> infoconn.php <?php session_start(); require 'dbconn.php'; if(isset($_POST['save_info'])) { $firstname = mysqli_real_escape_string($con, $_POST['firstname']); $lastname = mysqli_real_escape_string($con, $_POST['lastname']); $datereg = mysqli_real_escape_string($con, $_POST['datereg']); $address = mysqli_real_escape_string($con, $_POST['address']); $phone = mysqli_real_escape_string($con, $_POST['phone']); $email = mysqli_real_escape_string($con, $_POST['email']); $query = "INSERT INTO persondetails (firstname,lastname,datereg,address,phone,email) VALUES ('$firstname', '$lastname', '$datereg', '$address', '$phone', '$email')"; $query_run = mysqli_query($con, $query); if($query_run) { $_SESSION['message'] = "Info Added"; header("Location: personcreate.php"); exit(0); } else { $_SESSION['message'] = "Failed to Add"; header("Location: personcreate.php"); exit(0); } } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.