I am currenlty making a forum website for my uni assignment and trying to insert topics into a subcategory. It keeps bring me to a blank page after pressing submit. the url is http://localhost:8000/addnewtopic.php?cid=1&scid=1 for the blank page, it also doesnt end up importing the data into my database
<?php
if (isset($_SESSION['username']))
{
echo "<form action='/addnewtopic.php?cid=".$_GET['cid']."&scid=".$_GET['scid']."' method='POST'>
<p>Title: </p>
<input type='text' id='topic' name='topic' size='100' />
<p>Content: </p>
<textarea id='content' name='content'></textarea><br />
<input type='submit' value='add new post' /><form>";
}
else
{
echo "<p>Please login first or <a href='register.html'>click here</a> to register.</p>";
}
?>
<?php
session_start();
include('db_connection.php');
$topic = addslashes($_POST['topic']);
$content = nl2br(addslashes($_POST['content']));
$cid = $_GET['cid'];
$scid = $_GET['scid'];
$insert = mysqli_query($conn, "INSERT INTO topics (category_id, subcategory_id, author, title, content, date_posted)
VALUES ('".$cid."', '".$scid."', '".$_SESSION['username']."', '".$topic."', '".$content."', NOW());");
if ($insert)
{
header("Location: topics.php?cid=".$cid."&scid=".$scid."");
}
?>