This topic is locked
[SOLVED]

 Send selected record by mail

9/15/2011 8:18:48 AM
PHPRunner General questions
S
sribeiro_gmr author

I want to send by mail the selected record in a list view after custom button click.

Followed the example provided in the help file, but no success.
List view


Table: litigios


Custom button "Enviar Mail" in list view with following code :
On server

global $dal;

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

$body="";

foreach(@$keys as $keyblock)

{

$arr=split("&",refine($keyblock["lit_id"]));

if(count($arr)<1)

continue;

$arr2=array();

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

$where = KeyWhere($arr2);

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

$datatmp=db_fetch_array($rstmp );

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

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

$body .= "Data: " . $datatmp['lit_data'] . "\n-----------\n\n";

}
// send the email

$email="sribeiro@cooplecnorte.pt";

$subject="Abertura Litigio";

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

'body' => $body));

$result["txt"] = "Email enviado.";
// if error happened print a message on the web page

if (!$arr["mailed"])

{

$errmsg = "Erro:
";

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

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

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

$result["txt"] = $errmsg;

}
On Client After

var message = result["txt"];

ctrl.setMessage(message);
No mail sent after record selection and "Enviar Mail" button clicked.

The button stays inactive until the page is refreshed.


Don't know where the problem is.
Best regards.

Sérgio

Sergey Kornilov admin 9/15/2011

This type of behaviour usually means some sort of error in PHP code.
I recommend to post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.

S
sribeiro_gmr author 9/20/2011



This type of behaviour usually means some sort of error in PHP code.
I recommend to post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.


Followed the solution sent by the support.

Replaced split() function by explode().

It's working now.
Thank you.