Proper Alert Messaging Redirect

This commit is contained in:
Evan G. 2024-04-22 08:44:13 -05:00
parent e23387c7c0
commit 3ac5490498
Signed by: fbievan
GPG key ID: 55FAB8CB6842F080
2 changed files with 11 additions and 4 deletions

View file

@ -14,18 +14,24 @@ $data = json_decode(file_get_contents('test.json'), true);
# Add
array_unshift($data , $savemsg);
$newURL = "http://192.168.1.180:9890/guestbook/index.html";
# Check name and message
if ($fname == "") {
header('Refresh:2; url=' . $newURL );
echo "There is no name, Try again with a name";
exit();
}
if ($fmsg == "") {
header('Refresh:2; url=' . $newURL );
echo "There is no message, Try again with a message";
exit();
}
file_put_contents('test.json', json_encode($data, JSON_PRETTY_PRINT));
echo $fmsg;
header('Refresh:2; url=' . $newURL );
echo "Your submisson has been added";
exit();