function delete_custom_text($id) { $update = "UPDATE custom_texts SET status ='deleted' WHERE id=" . $id; $result = mysql_query($update); if (!$result) { echo "'Error deleting the custom text from the database: " . $update . "<br>"; } else { $custom_text = get_custom_text($id); echo "<div class=\"center\"><h1>Success!</h1>" . "<h3>The custom text <span class=\"success\">" . $custom_text['title'] . "</span> has been deleted.</h3></div>"; } }
echo '<div class="top-spacer_20 center error">Error - missing ID value</div>'; } elseif ($action == "update") { $custom_text = get_custom_text($id); echo "<form action=\"custom_text_update.php?id=" . $id . "\" method=\"post\" class=\"form-internal inline input-seperation\" id=\"admin\">"; require "partials/_custom_text_form.php"; echo "</form>"; } else { $title = $_POST['title']; $html = $_POST['html']; if (!$title || !$html) { echo '<div class="top-spacer_20 center error">Error - missing required value(s)</div>'; } else { $result = update_custom_text($id, $title, $html); if ($result) { echo '<div class="top-spacer_20"><h1 class="center">Update was successful!</h1>'; display_custom_text(get_custom_text($id)); echo "</div>"; } } } ?> <div class="top-spacer_20"> <a href="custom_text_view_all.php">View all Custom Texts</a> <p> <a href="cp.php">Control Panel</a> </div> </div> </div> <!-- end of row div --> <?php } require "partials/_footer.php";