October 2009
Beginner
408 pages
7h 27m
English
Now that index.php exists, you want to be taken to your new entries after they are submitted. To do this, you need to change the address of the header() calls to take the user to index.php. Change the code in bold in update.inc.php to make this happen:
<?php if($_SERVER['REQUEST_METHOD']=='POST' && $_POST['submit']=='Save Entry') { // Include database credentials and connect to the database include_once 'db.inc.php'; $db = new PDO(DB_INFO, DB_USER, DB_PASS); // Save the entry into the database $sql = "INSERT INTO entries (title, entry) VALUES (?, ?)"; $stmt = $db->prepare($sql); $stmt->execute(array($_POST['title'], $_POST['entry'])); $stmt->closeCursor(); // Get the ID of the entry we just saved $id_obj = $db->query("SELECT ...Read now
Unlock full access