php-guestbook/form.php

22 lines
504 B
PHP
Executable File

<?php
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;