Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Passing/echoing a search result in an email script

Featured Replies

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 = '[email protected]';

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

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

$headers = 'From: [email protected]';

mail($to, $subject, $msg , $headers, '[email protected]');

$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: [email protected]'. "rn" .

'Reply-To: [email protected]' . "rn" .

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

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

?>

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.