Created
March 18, 2016 22:46
-
-
Save kimonostereo/d1a8ec78b15527c58f1a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include ("/www/fmphp/access.php"); | |
//'respondent_exists' will be set if the user is coming from the Respondent.php page | |
//Grab the user input from the $_POST data | |
$respondent_data = array( | |
'firstname' => $_POST['firstname'], | |
'lastname' => $_POST['lastname'], | |
'email' => $_POST['email'] | |
); | |
//Validate the user input. | |
if ( empty($respondent_data['firstname']) | |
|| empty($respondent_data['lastname']) | |
|| empty($respondent_data['email']) | |
) { | |
//If data is missing, prompt them with a message. | |
echo '<h3>Some of your information is missing. Please go back and fill out all of the fields.</h3>'; | |
} else { | |
//If user input is valid, add the first name, last name and the email address in the Respondent layout | |
$newRequest =& $fm->newAddCommand('Layout #1', $respondent_data); | |
$result = $newRequest->execute(); | |
//check for an error | |
if (FileMaker::isError($result)) { | |
echo "<p>Error: " . $result->getMessage() . "<p>"; | |
exit; | |
} | |
//Display a success/thank you message | |
echo '<p>Thank you for your information.</p>'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment