The requested URL was not found on this server.
I have a table in the database titled persondetails
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/[email protected]/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" 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/[email protected]/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);
}
}
?>
message.php
<?php
if(isset($_SESSION['message'])) :
?>
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<strong>Holy guacamole!</strong> Success! <?= $_SESSION['message'] ?>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<?php
unset($_SESSION['message']);
endif;
?>`
dbconn.php
`<?php
$con = mysqli_connect("localhost","root","","exam_torres");
if(!$con) {
die('Connection Error'. mysqli_connect_error());
}
?>
I have tried looking at other posts with the same problem, but all the suggested answers and solutions proved to be unfruitful.