This topic is locked

Send specific field

10/27/2010 4:41:36 AM
PHPRunner General questions
R
Renex author

Is there a way to email specific fields after a record add?

Z
Zxenop 10/27/2010

Yes, in the AfterAddevent, the function has 3 parameters, $values an array that contain the datas of each fields, $keys that contains all the key value of the added row and $inline a boolean to check if the row has been added with the inline feature.
What you wanna do is access the fields data with the$values array, using the send email with new data example it should give you something like that



//********** Send email with new data ************
$email="test@test.com";

$from="admin@test.com";

$msg="";

$subject="New data record";
$msg.= $values["The Field Name"]; // This access the field value



$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));

if(!$ret["mailed"])

echo $ret["message"];



Note that The Field Name should be the

R
Renex author 10/27/2010

Big thanks to you!! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=53937&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />
Is there also a option to email the fields on different lines?
Sort of like this:
$msg.= $values["Naam"];

$msg.= "<br/>";

$msg.= $values["Afdeling/Werkmaatschappij"];



Yes, in the AfterAddevent, the function has 3 parameters, $values an array that contain the datas of each fields, $keys that contains all the key value of the added row and $inline a boolean to check if the row has been added with the inline feature.
What you wanna do is access the fields data with the$values array, using the send email with new data example it should give you something like that



//********** Send email with new data ************
$email="test@test.com";

$from="admin@test.com";

$msg="";

$subject="New data record";
$msg.= $values["The Field Name"]; // This access the field value
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));

if(!$ret["mailed"])

echo $ret["message"];



Note that The Field Name should be the

Z
Zxenop 10/27/2010



Big thanks to you!! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=53938&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />
Is there also a option to email the fields on different lines?
Sort of like this:
$msg.= $values["Naam"];

$msg.= "<br/>";

$msg.= $values["Afdeling/Werkmaatschappij"];



Yep with a

."\r\n";

at the end of each line;

R
Renex author 10/27/2010

Great!! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=53939&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />
Now I need to look for a option that display's $_SESSION['REMOTE_USER'].
Thank you!!



Yep with a

."\r\n";

at the end of each line;