|
|
|
|
![]() ![]() |
Apr 3 2005, 05:32 AM
Post
#1
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 629 Joined: 26-February 05 Member No.: 3,995 |
I'm making a forum and I've had several problems tonight which I've come here to ask then found the answer to myself, but this one is stumping me. Whenever it goes to write the post to the database, it saves the poster, and the time, but the part where the message would go is empty. Here's the code, with comments about what it's supposed to do (what I wanted it to do and thought it did):
CODE $imsg = stripslashes($_POST['msg']); //Get message That's how it takes the message and processes it. The rest is as follows:if(strlen($imsg) > 5 && strlen($imsg) < 10240) //Check length { $imsg = htmlspecialchars($imsg); //Change stuff to entities $imsg = str_replace("&","&",$imsg); //Change ampersands back $allowedentities = array('<b>','</b>','<i>','</i>','<u>','</u>', '<B>','</B>','<I>','</I>','<U>','</U>','<br>', '<BR>','<Br>','<bR>'); //Tell which entities to change into tags $allowedtags = array('<b>','</b>','<i>','</i>','<u>','</u>','<B>','</B>','<I>','</I>','<U>', '</U>','<br>','<BR>','<Br>','<bR>'); //Tell which tags to turn them into $imsg = str_replace($allowedentities,$allowedtags,$imsg); //Replace $msg = nl2br($imsg); //Add line breaks echo "<table class=\"posts\"><tr><td class=\"msg\">$msg</td></tr></table><br> <form method=\"post\" action=\"temppost.php\" name=\"f2\"><input type=\"submit\" name=\"post\" value=\"Post Message\"></form>"; //Display preview of post and post button } CODE $postedby = $username; //Get user posting I'm not sure if it's something about the $msg variable being available in the different parts or the mySQL table. I'm kind of new to it. The data type for the message was originally a BLOB, if that matters. I tried changing it to TEXT and it still didn't work.
$postedon = date("F jS, Y \a\\t g:i:sa"); //Get date/time mysql_query("INSERT INTO `tempposts` (`postedby`,`postedon`,`msg`) VALUES ('$postedby','$postedon','$msg')"); //Send it to database |
|
|
|
Apr 3 2005, 01:37 PM
Post
#2
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 113 Joined: 14-January 05 From: Philippines Member No.: 3,271 |
i tested your srcipt by using my own database and substituted a fixed value for $imsg and $postedby. it worked for me so i am really wondering now what happened.
|
|
|
|
Apr 3 2005, 08:23 PM
Post
#3
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 629 Joined: 26-February 05 Member No.: 3,995 |
|
|
|
|
Apr 4 2005, 01:14 AM
Post
#4
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 113 Joined: 14-January 05 From: Philippines Member No.: 3,271 |
QUOTE(beeseven @ Apr 4 2005, 04:23 AM) no prob! |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 12th October 2008 - 09:42 AM |