This topic is locked

after record updated

6/18/2010 1:13:16 PM
PHPRunner General questions
M
munkeh author

Hi,
I have a few after record updated events.

One of the events is that it sends an email.

=>

When the checkbox is checked it sends an email to the email address the customer put in.

The problem is, when I try to update another field it sends the email again to the customer (since it does the event again)
code :
if ($values["ACCEPT"])

{

// ** Send simple email ****

$email= $values["email"];

$naam= $values["naam"];

$code= $values["code"];

$gratis1= $values["gratis1"];

$gratis2= $values["gratis2"];

$betalend1= $values["betalend1"];

$betalend2= $values["betalend2"];

$freepass1= $values["freepass1"];

$freepass2= $values["freepass2"];

$paypass1=$values["paypass1"];

$paypass2=$values["paypass2"];

$totaal = $values["totaal"];

$subject = "test";

$message = "bit of text";

}
if ($values["DENY"])

{

// ** Send simple email ****

$email= $values["email"];

$naam= $values["naam"];

$code= $values["code"];

$gratis1= $values["gratis1"];

$gratis2= $values["gratis2"];

$betalend1= $values["betalend1"];

$betalend2= $values["betalend2"];

$freepass1= $values["freepass1"];

$freepass2= $values["freepass2"];

$paypass1=$values["paypass1"];

$paypass2=$values["paypass2"];

$totaal = $values["totaal"];

$subject = "subject";
$message = "message here";

}
// Always set content-type when sending HTML email

$headers = "MIME-Version: 1.0" . "\r\n";

$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";// More headers

$headers .= 'From: email@someemail.com. "\r\n";

mail($email,$subject,$message,$headers);
//** Redirect to another page ****

header("Location:Gast_list.php");

exit();
Is there a way to solve this?

Sergey Kornilov admin 6/18/2010

If guess you need to use something like this:

if ($values["ACCEPT"] && !$oldvalues["ACCEPT"])

{

...

}