seksislav Posted February 4, 2008 Share Posted February 4, 2008 Hello everybody, I dont know if i'm just targed or what might be wrong with my code ... so i'm trying to make a private message system. The first thing i'm trying to make it the inserting part in the messages table. This is my form in messages.php <form action="messages.php" method="POST"> Send to: <br> <input type="text" name="message_to" maxlength="32"> <br> Subject:<br> <input type="text" name="message_subject" maxlength="50"> <br> Send what?: <br> <textarea name="message_text"></textarea> <input type="hidden" name="sendmsg" value="1"><br> <input type="submit" value=" Send"> </form> this is my what i have in messageprocess.php class messageProcess { function messageProcess(){ global $session; if (!$session->logged_in) { header("Location: main.php"); return; } if ($_POST['sendmsg']){ $this->procSendMessage; } else { header("Location: main.php"); } } some other code u dont need to see... function procSendMessage() { global $session,$database; $message_from = 'blabablab'; $time = date('Y-m-d g:ia'); $message_subject = $_POST['message_subject']; $message_text = $_POST['message_text']; $database->sendMessage($message_to,$message_from,$message_subject,$message_text); header("Location: ".$session->referrer); } an this is what i have in my database class function sendMessage($message_to,$message_from,$message_subject,$message_text) { $time = date('Y-m-d g:ia'); $q = "INSERT INTO ".TBL_MESSAGES." VALUES ('0','$message_to','$message_from','$time','$message_subject','$message_text','n','NULL')"; return mysql_query($q,$this->connection); } my tbl its the same like the one in the private message system tutorial in the site. I'm just editing it to adjust it to my scripts. Can anybody gimme a hint what my problem might be? If u didnt get what i meen my problem is that i dont insert the query in the table :/ Quote Link to comment https://forums.phpfreaks.com/topic/89352-solved-my-form-not-working-dunno-why/ Share on other sites More sharing options...
trq Posted February 4, 2008 Share Posted February 4, 2008 For starters, your form points to messgaes.php not messageprocess.php. Other than that, if your code gets to this point try... return mysql_query($q,$this->connection) || die(mysql_error()); So you might see whats happening. Quote Link to comment https://forums.phpfreaks.com/topic/89352-solved-my-form-not-working-dunno-why/#findComment-457536 Share on other sites More sharing options...
seksislav Posted February 4, 2008 Author Share Posted February 4, 2008 yeah I was trying some different things to solve this thats why i changed it but its the same thing. its suppose to be messageprocess.php Quote Link to comment https://forums.phpfreaks.com/topic/89352-solved-my-form-not-working-dunno-why/#findComment-457544 Share on other sites More sharing options...
trq Posted February 4, 2008 Share Posted February 4, 2008 Did you try my second idea? Quote Link to comment https://forums.phpfreaks.com/topic/89352-solved-my-form-not-working-dunno-why/#findComment-457546 Share on other sites More sharing options...
seksislav Posted February 4, 2008 Author Share Posted February 4, 2008 yep mate but i dont get any error back. I did find one stupid mistake : if ($_POST['sendmsg']){ $this->procSendMessage; } was suppose to be procSendMessage(); I also changed header("Location:". $session->referrer) to header("Location: messages.php"); cuz i dont get redirected when the function is completed and still dont. So i guess the problem is somewhere there. Quote Link to comment https://forums.phpfreaks.com/topic/89352-solved-my-form-not-working-dunno-why/#findComment-457559 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.