could someone help me i can't seem to insert data into mysql table and don't know whats gone wrong //create_cat.php
include 'mysql.php'; include 'header.php'; echo '<h2>Create a topic</h2>'; if($_SESSION['loggedIn'] == false) { //the user is not signed in echo 'Sorry, you have to be <a href="signin.php">signed in</a> to create a topic.'; } else { //the user is signed in if($_SERVER['REQUEST_METHOD'] != 'POST') { //dropdown is being used here where we'll retrieve the catagories from the database for use in the dropdown $sql = "SELECT id, name, description FROM catagories"; $result = mysql_query($sql); if(!$result) { //query did not work echo 'Error while selecting from database. Please try again later.'; } else { if(mysql_num_rows($result) == 0) { //there are no catagories, so a topic can't be posted if($_SESSION['user_level'] == 1) { echo 'You have not created catagories yet.'; } else { echo 'Before you can post a topic, you must wait for an admin to create some catagories.'; } } else { echo '<form method="post" action=""> Subject: <input type="text" name="subject" /> Category:'; echo '<select name="cat">'; while($row = mysql_fetch_assoc($result)) { echo '<option value="' . $row['id'] . '">' . $row['name'] . '</option>'; } echo '</select>'; echo 'Message: <textarea name="post_content" /></textarea> <input type="submit" value="Create topic" /> </form>'; } } }