Jump to content

Recommended Posts

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 :/

Link to comment
https://forums.phpfreaks.com/topic/89352-solved-my-form-not-working-dunno-why/
Share on other sites

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.

 

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.