-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSaveRegistration.php
40 lines (31 loc) · 1.53 KB
/
SaveRegistration.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
include_once "OpenDb.php";
if (session_id() == "") session_start();
$postData = $_SESSION["RegData"];
$db = OpenPDO();
$db->beginTransaction();
$fieldList = 'eventCode, amountDue, firstName, lastName, address, city, state, zipcode, email, phone, paymentType, reference, experience, placeToStay';
$stmt = $db->prepare("INSERT INTO edc_event ($fieldList, regDate, reg_id) VALUES (:" .
preg_replace('/,\s*/',',:',$fieldList) . ',current_timestamp(), :reg_id)');
$stmt->bindValue(':eventCode', $postData['eventCode']);
$stmt->bindValue(':amountDue', $postData['amountDue']);
$stmt->bindValue(':firstName', $postData['firstName']);
$stmt->bindValue(':lastName', $postData['lastName']);
$stmt->bindValue(':address', $postData['address']);
$stmt->bindValue(':city', $postData['city']);
$stmt->bindValue(':state', $postData['state']);
$stmt->bindValue(':zipcode', $postData['zipcode']);
$stmt->bindValue(':email', $postData['email']);
$stmt->bindValue(':phone', $postData['phone']);
$stmt->bindValue(':paymentType', $postData['paymentType']);
$stmt->bindValue(':reg_id', md5(uniqid(rand(),1)));
$stmt->bindValue(':reference', $postData['reference']);
$stmt->bindValue(':experience', $postData['experience']);
$stmt->bindValue(':placeToStay', $postData['placeToStay'] == 'on');
ExecutePDO($stmt);
$regNbr = $db->lastInsertId();
$postData["regNbr"] = $regNbr;
$_SESSION["RegData"] = $postData;
$db->commit();
TraceMsg("Data Has Been Recorded, RegNbr is $regNbr");
?>