I'm coding my own message boards and I've hit a snag. I'm trying to code the script that will allow the user to start a new topic. One of the fields in the "topics" table is the name of the author, and the info to be put into that field is the info stored in a cookie known as "character".
Everything else about the script works correctly except for this. The author field is just empty, I get no errors... nothing.
Here are the variables:
$forum = $_GET['id'];
$type = $_GET['type'];
$character = $_COOKIE['character'];
Those variables are then put into hidden input fields to be taken to the second part of the script that will only run once the form is filled out. The structure of these input tags are:
<input type="hidden" name="author" value="<?php print "$character"; ?>" />
<input type="hidden" name="type" value="<?php print "$type"; ?>" />
<input type="hidden" name="forum" value="<?php print "$forum"; ?>" />
The second time my script is run, I make variables based on the POST'd input:
$title = $_POST['title'];
$content = $_POST['content'];
$type = $_POST['type'];
$forum = $_POST['forum'];
$author = $_POST['author'];
And lastly, this is the query I'm trying to run:
$query = "INSERT INTO topics (id,title,forum,author,replies,lastpost,icon,created,content) VALUES (0,'$title','$forum','$author',0,NOW(),'$type',NOW(),'$content')";
As I said before, everything BUT the author field is being filled as it is supposed to. I have also noticed that if I reduce the URL from "new.php?id=1&type=ooc" to simply "new.php" I can PRINT out the cookie's variable, so something is being stored there. However, the script isn't running correctly that method either.
Thanks in advance!