php-guestbook/form.php

22 lines
504 B
PHP
Raw Normal View History

2021-12-21 23:09:31 +00:00
<?php
2021-12-22 21:41:48 +00:00
include_once('persistence.php');
$db = createDB();
function newMessagePOST($db) {
if(isset($_POST['message']) && $_POST['message']) {
if(isset($_POST['name']) && $_POST['name']) {
$name = $_POST['name'];
$message = $_POST['message'];
storeMessage($db, $message);
}
else {
$message = $_POST['message'];
storeMessage($db, $message);
}
}
}
newMessagePOST($db);
header("Location: /index.php");
exit;