This topic is locked
[SOLVED]

 Events not working (Online Hosting)

10/21/2011 6:39:13 PM
PHPRunner General questions
A
angelcause author

I created a button and added the update code so by a click I will get all the data of the member, but when someone clicks the button it functions properly but I dont get the email.
I am using shared hosting. Is it because of the hosting?

C
cgphp 10/21/2011

Post the button code.

A
angelcause author 10/22/2011

I have inserted the button code from the help docs provided by phprunner in the SERVER tab

global $dal;

$dal_TableName = $dal->Table("workplan");

$body="";

foreach(@$keys as $keyblock)

{

$arr=explode("&",refine($keyblock["ActId"]));

if(count($arr)<1)

continue;

$arr2=array();

$arr2["ActId"]=urldecode(@$arr[0]);

$where = KeyWhere($arr2);

$rstmp = $dal_TableName->Query($where,"");

$datatmp=db_fetch_array($rstmp );

$body .= "Activity: " . $datatmp['Activity'] . "\n";

}



// send the email

$email="atta@gmail.com";

$subject="Workplan Completed of PPTC";

$arr = runner_mail(array('to' => $email, 'subject' => $subject,

'body' => $body));

$result["txt"] = "Your workplan is updated to M&E Section.";



// if error happened print a message on the web page

if (!$arr["mailed"])

{

$errmsg = "Error happened:
";

$errmsg.= "File: " . $arr["errors"][0]["file"] . "
";

$errmsg.= "Line: " . $arr["errors"][0]["line"] . "
";

$errmsg.= "Description: " . $arr["errors"][0]["description"] . "
";

$result["txt"] = $errmsg;

}
C
cgphp 10/22/2011

Try to send an email outside the custom button.

A
angelcause author 10/22/2011



Try to send an email outside the custom button.


I am a newbie, can you please guide me through how to send the email outside the custom button.

C
cgphp 10/22/2011

Paste this code in the "List page: Before process" event:

$headers = "From: You <atta@gmail.com>";

mail('atta@gmail.com', 'This is a test', 'Hello world', $headers);