🐛 Fix alerting system for new request form

Signed-off-by: Luke Tainton <luke@tainton.uk>
This commit is contained in:
2020-08-04 19:49:42 +01:00
parent 476c5c03d1
commit 68b0e4a565
2 changed files with 14 additions and 14 deletions

View File

@@ -67,14 +67,3 @@
</div> </div>
</nav> </nav>
</header> </header>
<section id="alerts">
<?php
foreach($_SESSION['alerts'] as $alert) {
echo("
<div class='alert alert-" . $alert['type'] . "' role='alert'>
" . $alert['msg'] . "
</div>
"); }
?>
</section>

View File

@@ -14,7 +14,7 @@
$sql->execute(); $sql->execute();
} catch (PDOException $e) { } catch (PDOException $e) {
// echo("Error: <br>" . $e->getMessage() . "<br>"); // echo("Error: <br>" . $e->getMessage() . "<br>");
create_alert("danger", "SQL Error: " . $e->getMessage()); $new_ticket_alert = array("danger", "SQL Error: " . $e->getMessage());
} }
// Get ticket UUID // Get ticket UUID
@@ -28,7 +28,7 @@
$tkt_uuid = $tkt_result['uuid']; $tkt_uuid = $tkt_result['uuid'];
} catch (PDOException $e) { } catch (PDOException $e) {
// echo("Error: <br>" . $e->getMessage() . "<br>"); // echo("Error: <br>" . $e->getMessage() . "<br>");
create_alert("danger", "SQL Error: " . $e->getMessage()); $new_ticket_alert = array("danger", "SQL Error: " . $e->getMessage());
} }
// If file is uploaded, process that // If file is uploaded, process that
@@ -47,7 +47,7 @@
$sql->execute(); $sql->execute();
} catch (PDOException $e) { } catch (PDOException $e) {
// echo("Error: <br>" . $e->getMessage() . "<br>"); // echo("Error: <br>" . $e->getMessage() . "<br>");
create_alert("danger", "SQL Error: " . $e->getMessage()); $new_ticket_alert = array("danger", "SQL Error: " . $e->getMessage());
} }
} }
@@ -62,6 +62,17 @@
<!-- Begin page content --> <!-- Begin page content -->
<main role="main" class="flex-shrink-0"> <main role="main" class="flex-shrink-0">
<section>
<?php
if(isset($new_ticket_alert)) {
echo("
<div class='alert alert-" . $new_ticket_alert[0] . "' role='alert'>
" . $new_ticket_alert[1] . "
</div>
"); }
?>
</section>
<section class="jumbotron text-center"> <section class="jumbotron text-center">
<div class="container"> <div class="container">
<h1>Create a new request</h1> <h1>Create a new request</h1>