But I checked and the variables and header all only use one line. Thanks
[php]
<?php session_start(); ?> <?phprequire ‘connection.php’; ?>
<?php //if submit clicked if (isset($_POST['topic_submit'])) { //If topic title field or message field empty if (($_POST['topic_title'] == "") && ($_POST['topic_content'] == "")) { echo "You didn't fill in both fields"; exit(); } else { $cid = $_POST['cid']; $title = $_POST['topic_title']; $content = $_POST['topic_content']; $creator = $_SESSION['username']; //Insert the entered data into the appropriate database fields $sql = "INSERT INTO topics (category_id, topic_title, topic_creator, topic_date, topic_reply_date) VALUES ('".$cid."', '".$title."', '".$creator."', now(), now())"; //Result of above query $result = mysqli_query($DBconnect, $sql) or die(mysqli_error()); //After it inserts into topics table, will generate the auto incremented id number associated with the row and puts it into the variable $new_topic_id $new_topic_id = mysqli_insert_id($DBconnect); //Insert the post into the database $sql2 = "INSERT INTO posts (category_id, topic_id, post_creator, post_content, post_date) VALUE ('".$cid."', '".$new_topic_id."', '".$creator."', '".$content."', now())"; //Store result from above query $result2 = mysqli_query($DBconnect, $sql2) or die(mysqli_error()); //Update which category was set last (keep track of WHO POSTED LAST AND WHEN LAST POST DATE WAS, only update 1 category) $sql3 = "UPDATE categories SET last_post_date=now(), last_user_posted='".$creator."' WHERE id='".$cid."' LIMIT 1"; //result of above query $result3 = mysqli_query($DBconnect, $sql3) or die(mysqli_error()); //Check all been performed if (($result) && ($result2) &&($result3)) { header("Location: view_topic.php?cid=".$cid."&tid=".$new_topic_id); } else { echo "error"; } } } ?>[/php]