<?php require_once('Connections/FMKickers_login.php'); ?>
<?php
$clinic_find = $FMKickers_login->newFindCommand('Clinics');
$clinic_findCriterions = array('clinicId'=>'=='.fmsEscape($_REQUEST['clinicId']),);
foreach($clinic_findCriterions as $key=>$value) {
    $clinic_find->AddFindCriterion($key,$value);
}

$user_find = $FMKickers_login->newFindCommand('Users');
$user_findCriterions = array('email'=>'=='.fmsEscape($_SESSION["FMKickers_login_tableLogin"]["user"]),'password'=>'=='.fmsEscape($_SESSION["FMKickers_login_tableLogin"]["pass"]),);
foreach($user_findCriterions as $key=>$value) {
    $user_find->AddFindCriterion($key,$value);
}

fmsSetPage($clinic_find,'clinic',10); 

fmsSetPage($user_find,'user',10); 

$clinic_result = $clinic_find->execute(); 

$user_result = $user_find->execute(); 

if(FileMaker::isError($clinic_result)) fmsTrapError($clinic_result,"error.php"); 

if(FileMaker::isError($user_result)) fmsTrapError($user_result,"error.php"); 

fmsSetLastPage($clinic_result,'clinic',10); 

fmsSetLastPage($user_result,'user',10); 

$clinic_row = current($clinic_result->getRecords());

 

$user_row = current($user_result->getRecords());

 

$registration_add = $FMKickers_login->newAddCommand('Registrations');
$registration_fields = array('userId'=>$user_row->getField('userId'),'clinicId'=>$clinic_row->getField('clinicId'),'childName'=>$_REQUEST['childName'],'childBirthdate'=>$_REQUEST['childBirthdate'],'childGender'=>$_REQUEST['childGender'],'childNotes'=>$_REQUEST['childNotes'],);
foreach($registration_fields as $key=>$value) {
    $registration_add->setField($key,$value);
}

$registration_result = $registration_add->execute(); 

if(FileMaker::isError($registration_result)) fmsTrapError($registration_result,"error.php"); 

$registration_row = current($registration_result->getRecords()); 

fmsRedirect('registration_payment.php'.'?registrationId='.$registration_row->getField('registrationId')); 
 // FMStudio v1.0 - do not remove comment, needed for DreamWeaver support ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>
</body>
</html>
