I am having a problem when an email is sent to the client, to notify the client of a new database entry.
Once the client receives the email, the email contains a URL, once the client uses the URL which triggers a form with the option to approve the membership.
Currenlty, my database is keyed by an autoincrementer...but at the time of the BeforeAdd Event I do not know the ID number yet, so I am using the second field which is the contact person to find the record that was just added...
I am new at PHP so here is what I have:
Function BeforeAdd(&$values)
{
// Parameters:
// $values - Array object.
// Each field on the Add form represented as 'Field name'-'Field value' pair
//********** Send email with new data ************
$headers = 'MIME-Version: 1.0' ."\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1\r\n';
$headers .= 'From: <admin@clientsdomain.com>' ."\r\n";
$email="client@clientsdomain.com";
$message ='<html>';
$message .='<body>';
$message .='<b> A new user has registered, Click the following link to approve membership: </b><br>';
$message .='<a href="http://www.clientsdomain.com/approve_member.php?contact='.$values['contact']."\r\n";;
$message .='">To Approve Member please use this link</a>';
$message .="</body>";
$message .="</html>";
$subject="New data record";
mail($email, $subject, $message, $headers);
return true;
// return true if you like to proceed with adding new record
// return false in other case
What is supposed to happen is when the client clicks on the URL, a form will open and the client will click a check box to approve the membership, but I am unable to get the record due to the single quotes:
This is how I would like it to look like(with out quotes for it to work with the Web browser):
http://www.clientsdomain.com/approve_member.php?contact=Jon Doe
But instead this is what I get:
http://www.clientsdomain.com/approve_member.php?contact='Jon Doe'
Please help, as to how I can remove the single quotes!
Is there a diffent way, maybe to query the database within the event and get the KEY which is an Integer instead ?
Thank you in advance!