84 lines
3.6 KiB
PHP
84 lines
3.6 KiB
PHP
|
<?php
|
||
|
ini_set('display_errors', 1);
|
||
|
ini_set('display_startup_errors', 1);
|
||
|
error_reporting(E_ALL);
|
||
|
session_start();
|
||
|
session_reset();
|
||
|
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||
|
require "$root/database/credentials.php";
|
||
|
// Connect the database
|
||
|
try {
|
||
|
$db = new PDO("mysql:host=$host;dbname=$database;charset=utf8",
|
||
|
$user,
|
||
|
$password,
|
||
|
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
|
||
|
));
|
||
|
} catch (Exception $e) {
|
||
|
die("Error : ".$e->getMessage());
|
||
|
}
|
||
|
if (isset($_GET['id'])){
|
||
|
?>
|
||
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
<title>Edit | Chiro - Canto</title>
|
||
|
<link rel="stylesheet" type="text/css" href="/styles/style.css">
|
||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||
|
</head>
|
||
|
<?php
|
||
|
include("$root/analytics/matomo.php");
|
||
|
include("$root/analytics/owa.php");
|
||
|
?>
|
||
|
<body>
|
||
|
<?php include("$root/menu.php");?>
|
||
|
<?php include("$root/header.php");?>
|
||
|
<section>
|
||
|
<h2>Edit</h2>
|
||
|
<?php
|
||
|
$req = $db->prepare('SELECT * FROM records WHERE id=:id');
|
||
|
$req->execute(array(
|
||
|
"id"=>$_GET['id']
|
||
|
));
|
||
|
if ($data = $req->fetch()){
|
||
|
?>
|
||
|
<form action="update.php" method="post">
|
||
|
|
||
|
<label for="file_name">File Name*</label>
|
||
|
<input type="text" id="file_name"value="<?=$data['file_name']?>" readonly>
|
||
|
<label for="coordinates">Coordinates*</label>
|
||
|
<input type="text" id="coordinates" value="<?=$data['lat']?>, <?=$data['lng']?>" readonly>
|
||
|
<label for="date">Date*</label>
|
||
|
<input type="date" name="date" id="date" value="<?=$data['date']?>">
|
||
|
<label for="time">Time*</label>
|
||
|
<input type="time" name="time" id="time" value="<?=$data['time']?>">
|
||
|
<label for="recordist-name">Recordist Name*</label>
|
||
|
<input type="text" name="recordist-name" id="recordist-name" value="<?=$data['recordist_name']?>" required>
|
||
|
<label for="species">Species*</label>
|
||
|
<input type="text" name="species" id="species" value="<?=$data['species']?>">
|
||
|
<label for="subpsecies">Subspecies</label>
|
||
|
<input type="text" name="subpseices" id="subspecies" value="<?=$data['subspecies']?>">
|
||
|
|
||
|
<label for="make">Recorder Manufacturer</label>
|
||
|
<input type="text" name="make" id="make" value="<?=$data['make']?>">
|
||
|
<label for="model">Recorder Model</label>
|
||
|
<input type="text" name="model" id="model" value="<?=$data['model']?>">
|
||
|
<label for="serial">Recorder Serial Number</label>
|
||
|
<input type="text" name="serial" id="serial" value="<?=$data['serial']?>">
|
||
|
|
||
|
</form>
|
||
|
<?php
|
||
|
} else {
|
||
|
$_SESSION['error_msg'] = "Can't fetch information on record with id '".$_GET['id']."'.";
|
||
|
}
|
||
|
echo $_SESSION['error_msg'];
|
||
|
?>
|
||
|
</section>
|
||
|
<?php include("$root/footer.php");?>
|
||
|
</body>
|
||
|
<script src="/scripts/script.js"></script>
|
||
|
</html>
|
||
|
<?php
|
||
|
}
|