Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kimonostereo/4b3243ea578eeaa02d60 to your computer and use it in GitHub Desktop.
Save kimonostereo/4b3243ea578eeaa02d60 to your computer and use it in GitHub Desktop.
Using in combination with the snippet Find EXACT Record for Editing, you can then put this on the results page to commit edits to a record.
<?php
include ("/www/htdocs/fmphp/access.php");
// grab the posted info and convert to vars
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$current_grade = $_POST['current_grade'];
$grad_year = $_POST['grad_year'];
$student_id = $_POST['student_id'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$ipad_pin = $_POST['ipad_pin'];
$checkin_time = $_POST['checkin_time'];
$checkin_date = $_POST['checkin_date'];
$checkin_location = $_POST['checkin_location'];
$type = $_POST['type'];
$summer_school = $_POST['summer_school'];
$recID = $_POST['recid']; // need this to make sure we edit the correct record
$respondent_recid = $_POST['id'];
if (FileMaker::isError($result)) {
echo 'unable to find the record to delete: ' . $result->message . '(' . $result->code . ')';
die();
}
// submit these posted info as edits
$cmd =& $fm->newEditCommand('Table', $recID);
$cmd->setField('first_name', $_POST['first_name']);
$cmd->setField('last_name', $_POST['last_name']);
$cmd->setField('current_grade', $_POST['current_grade']);
$cmd->setField('grad_year', $_POST['grad_year']);
$cmd->setField('student_id', $_POST['student_id']);
$cmd->setField('email', $_POST['email']);
$cmd->setField('phone', $_POST['phone']);
$cmd->setField('ipad_pin', $_POST['ipad_pin']);
$cmd->setField('checkin_time', $_POST['checkin_time']);
$cmd->setField('checkin_date', $_POST['checkin_date']);
$cmd->setField('checkin_location', $_POST['checkin_location']);
$cmd->setField('type', $_POST['type']);
$cmd->setField('summer_school', $_POST['summer_school']);
$result = $cmd->execute();
if (FileMaker::isError($result)) {
echo 'unable to delete the record: ' . $result->message . '(' . $result->code . ')';
die();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment