Hi!
I'm presently redoing my website, and I'm using wordpress as a CMS. I wish to re-use a chatboard I had on the old website, but I'm having problems passing the variables through. What could be the problem?
Here's my form:

HTML Code:
<form action="http://www.mydomain.com/chat/post.php" method="post" id="comment-form">
<fieldset>
	<p style="float:left"><label for="user_name">Nom ou pseudo&nbsp;:</label><br />
	<input name="user_name" id="user_name" type="text" size="25" maxlength="255" /></p>
	

	<p style="float:right"><label for="user_email">URL&nbsp;:</label><br />
	<input name="user_email" id="user_email" type="text" size="25" maxlength="255" value="http://" /></p>

	<p><label for="chat_body">Commentaire&nbsp;:</label><br />
	<textarea class="center" id="chat_body" name="chat_body" cols="57" rows="3"></textarea>
	</p>
</fieldset>

<fieldset>	
<p class="center pad"><input type="submit" class="submit" name="Sign" value="Go !" size="25" /></p>
</fieldset>	
</form>
That's my post.php file:

PHP Code:
 // my connexion parameters to DB here

// do a basic check, don't let user submit a blank entry.

if ($user_name == '' || $chat_body == '' )
{
    echo 
"error message";
die;

}

// strips off weird characters and HTML tags
$allowable_tags "<B><I><LI><OL><P><U><UL><S>";
htmlspecialchars($user_name);
$chat_body strip_tags($chat_body$allowable_tags);

// do check here

$last_entry "select * from shoutbox order by id desc limit 1";
$check mysql_query($last_entry);

while (
$row mysql_fetch_array($check))
{
$oldname $row["user_name"];
$oldmsg $row["chat_body"];
}

// compare the values of old and new entry
if ($oldname == $user_name && $oldmsg == $chat_body// means the name and msg entered is the same
{
    echo 
"Another error message here";
die;



// check comments :

/**
* Check presence of 'bad strings'.
*/
function contains_badwords($string) {
$bad_words = array(
                      
// here, an array of spam words          
                     
);
   foreach(
$bad_words as $bad_word) {
     if(
eregi($bad_wordstrtolower($string))) {
        return 
true;
     }
   }
   return 
false;

 
if (
contains_badwords($chat_body)) {
   
header("HTTP/1.0 200 OK"); //Send out a content is good/complete to make it look as though things have gone well
    
header('Refresh: 1; url=http://spam.abuse.net/'); //polite redirect
      
header("Connection: close");
      exit(); 
}

if (
contains_badwords($user_name)) {
   
header("HTTP/1.0 200 OK"); //Send out a content is good/complete to make it look as though things have gone well
    
header('Refresh: 1; url=http://spam.abuse.net/'); //polite redirect
      
header("Connection: close");
      exit(); 
}

// check IP
$user_ip $_SERVER['REMOTE_ADDR'];

    include_once (
'baniplist.php');
    
    
$check checkBan($user_ip);
    if (
$check == 1)
    {
    echo 
"Another error message here";
die;
}
 if (
$check == 0)
 {
 
// insert into database
$q "insert into shoutbox (id,user_name,chat_body,user_email,date_time,user_ip) VALUES ('','$user_name','$chat_body','$user_email',now(),'$user_ip')";
$result mysql_query($q);
}
if (
$result)
{
// success so redirect user to view shoutbox.
$siteurl 'http://www.mydomain.com/tagboard'// it's a wordpress template, hence the lack of "php" extension
header('Location: '.$siteurl);
}
?> 
I obviously got rid of the unimportant stuff, like the spam words and the error messages, in order to post only the essential.
When I test it, I get the first error message, which means the infos aren't passed through.

So, I was thinking I could maybe put everything in one file, but I'm clueless to how to do that. I tried making my post.php content into a function and calling the function on submit, but it didn't work.
I'd really appreciate all advice!

Thanks