I put together a class catalog and registration application a while back for a client and it’s been working great with the exception of one small bug that I can’t seem to be able to locate. I have it setup using Table Events (After Record Added) in PHPR to send an email once someone registers online and also to redirect the registrant to another page once they have registered. The redirection works great, no problems there, it’s just the email thing that’s giving me issues. Here’s the weirdest part of the deal, occasionally an email will go through the system and make it’s way out… It’s real sporadic though.
I posted a note on Xlinesoft’s Forum, hopefully someone will have some advice as to where I might look to troubleshoot this issue out. Here’s the table event code that I am using to send the email out after a record is added and also to redirect the visitor. If any of you out there have any suggestions I would love to hear from you.
1: // Parameters:
2: // $values - Array object.
3: // Each field on the Add form is represented as a 'Field name'-'Field value' pair
4: // $keys - Array object with added record key column values
5:
6:
7: //********** Redirect to another page ************
8: header("Location: http://www.anurturingtouch.com/confirmation.php");
9: exit();
10:
11:
12:
13: // ********** Send simple email ************
14:
15: $email="[email protected]";
16: $message="New Registration has been made on your website, please login and retrieve their information, http://www.anurturingtouch.com/cms";
17: $subject="New Registration";
18: mail($email, $subject, $message);
Mott says
Cotton, do this, try moving the table event for the redirect after your email instructions.
Cotton Rohrscheib says
Just an update on this, Jane was able to help me get this fixed…
// ********** Send simple email ************
$email=”[email protected]”;
$message=”New Registration has been made on your website, please login and retrieve their information, http://www.anurturingtouch.com/cms“;
$subject=”New Registration”;
if (mail($email, $subject, $message))
echo “email was sent”;
else
echo “error”;
//********** Redirect to another page ************
header(“Location: http://www.anurturingtouch.com/confirmation.php“);
exit();
Nick says
The problem was because you were exiting the scripts execution with “exit();”, prior to the mail function.