Jump to content

php function not being called


MDanz

Recommended Posts

Here's some of my code.  The fault is when AJAX sends the dataString to sendpm.php, it should call the function.  But nothing is happening.  If i put the sendprivatemessage query in sendpm.php page, the data is sent to mysql.  What is the solution, so i don't have to put the query on sendpm.php?

 

jquery - some of it

$.ajax({
	type: "POST",
	url: "/sendpm.php",
	data: dataString,
	success: function() {
	window.location.href = 'http://www.stackway.com/cp/messages=outbox';
	}

	});

 

sendpm.php

include "database.php";

$to = $_POST['to'];
$from = $_POST['from'];
$subject = $_POST['subject'];
$body = $_POST['body'];

$database2 = new Database();
$database2->opendb();
$database2->sendprivatemessage($to,$from,$subject,$body);
$database2->closedb();

 

 

sendprivatemessage function

function sendprivatemessage($to,$from,$subject,$body) {

	$insert = mysql_query("INSERT INTO privatemessage VALUES ('','$subject','$body','$to','$from','1',NOW(),'','','')",$this-connect);

	}

 

Link to comment
Share on other sites

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.