email beforeadd function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
longbo43
Forum Newbie
Posts: 10
Joined: Tue Apr 20, 2010 2:33 am

email beforeadd function

Post by longbo43 »

Hi

I am using a form to allow users to enter meeting requests which are then used by a telemarketing company to run campaigns to target customers at potential client companies to arrange meetings for the users sales team.

Each record is added to a MySQL database. When they save the form it creates the array of info to be added to the record and emails this to the user with their entries embedded into the body of the email

My problem is that the Autonumber field I am using in MySQL to id the meetings is not populated with anything. When the email is sent everything is displaying but where the ID should be it is blank. I have posted the code below for the generation of the email.

Can someone please help cause I am going crazy :banghead:

Code: Select all

$email=$values["User_Email"];
$from=$values["User_Email"];
$cc="user@email.com.com";
$msg="";
$subject="Meeting Request ".$values["Operator"].", ".$values["Target1_Contact_Surname"].", Meeting ID ".$values["Meeting_ID"]; [color=#40FF40]//Meeting_ID is not displaying in the email[/color]

foreach($values as $field=>$value)
{
	if(!IsBinaryType(GetFieldType($field)))
		$msg.= $field." : ".$value."\r\n";
}
	
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from' => $from, 'cc' => $cc)); [color=#40FF40]//Meeting_ID is blank in here to but everything else that was entered in the form is fine.[/color]
if(!$ret["mailed"])
	echo $ret["message"];




return true;
I have obviously been doing a bit of reading and I think, and I stress think, need to use something like MySQL_insert_id() but I don't have a clue how to do this.

Please needing your help.

Cheers
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: email beforeadd function

Post by Christopher »

Are you sure the key is 'Meeting_ID'? Use var_dump() or print_R() to display $values and see what is actually in the array. Either you are not fetching it, or it has a different key.
(#10850)
Post Reply