Jump to content

This topic is 5791 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi there,

I have a script which creates a new Filemaker record with automatically generated password. I want to grab the password from the DB and include it in an email that goes to the subscriber. Please see code below. After calling FMNew to create the new DB record and generate the password I have called FMFind to search for the record but I keep getting no records found so cant get the password from the DB to show in the email. Any assistance gratefully received.

<?php

include_once('FX/FX.php');

include_once('FX/server_data.php');

$firstname = $_POST['firstname'];

$lastname = $_POST['lastname'];

$email = $_POST['email'];

$newsurvey = new FX($serverIP,$webCompanionPort);

$newsurvey -> SetDBData('OOHC_Education_Survey_2008.fp7', 'OOHC_and_LC_Survey_2009');

$newsurvey -> SetDBPassword($webPW, $webUN);

$newsurvey-> AddDBParam('Email_Address', $email);

$newsurvey -> AddDBParam('First_Name', $firstname);

$newsurvey -> AddDBParam('Last_Name', $lastname);

$newsurveyResult = $newsurvey -> FMNew();

echo $newsurveyResult['errorCode'];

$newsurveyData = current($newsurveyResult['data']);

$findsurvey = new FX($serverIP,$webCompanionPort);

$findsurvey -> SetDBData('OOHC_Education_Survey_2008.fp7', 'OOHC_and_LC_Survey_2009');

$findsurvey -> SetDBPassword($webPW, $webUN);

$findsurvey -> AddDBParam('Email_Address', $email);

$findsurvey -> AddDBParam('First_Name', $firstname);

$findsurvey -> AddDBParam('Last_Name', $lastname);

$findsurveyResult=$findsurvey->FMFind();

$returnedCount=$findsurveyResult['foundCount'];

echo $findsurveyResult['errorCode'];

foreach($findsurveyResult['data'] as $key=>$findsurveyData);

$password = $findsurveyData['Password'][0];

$to = 'steven@acwa.asn.au';

$subject = "Survey Entry: $firstname $lastname";

$msg = "The survey database has received a new or updated entry:n";

$headers = 'From: steven@acwa.asn.au';

mail($to, $subject, $msg , $headers, '-fsteven@acwa.asn.au');

$subject = "OOHC and Leaving Care Survey 2009: $firstname $lastname";

$msg = wordwrap($msg, 70);

$msg = "Dear $firstnamen";

$msg .= "n";

$msg .= "Thank you for participating in this survey. Please go to http://www.acwa.asn.au/survey3.php to login.n";

$msg .= "n";

$msg .= "Your username is your email address: $email.n";

$msg .= "Your password is: $password.n";

$msg .= "n";

$msg .= "If you require further assistance please contact me on 02 9281 8822.n";

$msg .= "n";

$msg .= "Yours sincerelyn";

$msg .= "Sylvia Ghalyn";

$msg .= "Manager, Policy and Membershipn";

$headers = 'From: steven@acwa.asn.au'. "rn" .

'Reply-To: steven@acwa.asn.au' . "rn" .

'X-Mailer: PHP/' . phpversion();

mail($email, $subject, $msg , $headers);

?>

This topic is 5791 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.