Jump to content

[SOLVED] My form not working .. dunno why.


seksislav

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.

 

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.