step 2 for form submission
add phone
This commit is contained in:
10
index.php
10
index.php
@@ -70,7 +70,7 @@ $router->post('/checkout', function () {
|
|||||||
// Sum the cart totals
|
// Sum the cart totals
|
||||||
$cartTotal = $eventTicketPrice + $tableTicketPrice + $ticketEnhancerPrice + $additionalContribution;
|
$cartTotal = $eventTicketPrice + $tableTicketPrice + $ticketEnhancerPrice + $additionalContribution;
|
||||||
|
|
||||||
$uuid = \Ramsey\Uuid\Uuid::uuid1();
|
$redirectUuid = $uuid = \Ramsey\Uuid\Uuid::uuid1();
|
||||||
|
|
||||||
// Instantiate order object
|
// Instantiate order object
|
||||||
$order = R::dispense('orders');
|
$order = R::dispense('orders');
|
||||||
@@ -110,6 +110,7 @@ $router->post('/checkout', function () {
|
|||||||
if ($i === 1) {
|
if ($i === 1) {
|
||||||
$guest->name = $_POST['firstName'] . ' ' . $_POST['lastName'];
|
$guest->name = $_POST['firstName'] . ' ' . $_POST['lastName'];
|
||||||
$guest->email = $_POST['email'];
|
$guest->email = $_POST['email'];
|
||||||
|
$guest->phone = $_POST['phone'];
|
||||||
$guest->stripe_id = $stripeCustomerToken;
|
$guest->stripe_id = $stripeCustomerToken;
|
||||||
}
|
}
|
||||||
$guest->order_id = $orderId;
|
$guest->order_id = $orderId;
|
||||||
@@ -117,8 +118,15 @@ $router->post('/checkout', function () {
|
|||||||
R::store($guest);
|
R::store($guest);
|
||||||
unset($guest, $uuid);
|
unset($guest, $uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
header('Location: /manage/' . $redirectUuid->toString());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$router->get('/manage/{uuid}', function ($uuid) {
|
||||||
|
$order = R::findOne('orders', ' uuid = ?', [$uuid]);
|
||||||
|
$guests = R::findAll('guests', ' order_id = ?', [$order->id]);
|
||||||
|
var_dump($order,$guests);
|
||||||
|
});
|
||||||
|
|
||||||
// Run it!
|
// Run it!
|
||||||
$router->run();
|
$router->run();
|
||||||
@@ -48,6 +48,13 @@
|
|||||||
Please enter a valid email address.
|
Please enter a valid email address.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="phone">Phone</label>
|
||||||
|
<input type="phone" class="form-control" id="phone" name="phone" required>
|
||||||
|
<div class="invalid-feedback">
|
||||||
|
Please enter a valid phone number.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="address">Address</label>
|
<label for="address">Address</label>
|
||||||
<input type="text" class="form-control" id="address" name="address" placeholder="1234 Main St" required>
|
<input type="text" class="form-control" id="address" name="address" placeholder="1234 Main St" required>
|
||||||
|
|||||||
Reference in New Issue
Block a user