Skip to content
Snippets Groups Projects
Commit 04bbde9f authored by bewe's avatar bewe
Browse files

feat: add email

parent 317c2a89
Branches
No related merge requests found
<?php
function buyItem($merchId, $userId)
function buyItem($merchId, $userId, $email)
{
// rest buy merchandise
$ch = curl_init();
......@@ -12,7 +12,8 @@ function buyItem($merchId, $userId)
CURLOPT_POSTFIELDS,
json_encode(
array(
"user_id" => (int)$userId
"user_id" => (int)$userId,
"email" => $email
)
)
);
......@@ -31,7 +32,8 @@ function buyItem($merchId, $userId)
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['buyMerch'])) {
$merchId = $_POST['merchId'];
$userId = $_POST['userId'];
$email = $_POST['email'];
buyItem($merchId, $userId);
buyItem($merchId, $userId, $email);
}
?>
\ No newline at end of file
......@@ -8,6 +8,7 @@ class Merchandise extends Controller
$data["pageTitle"] = "Merch!";
$data["user_id"] = $_SESSION['user_id'];
$data["email"] = $_SESSION['email'];
// user's gems
$baseUrl = 'http://soap:8080/service/gems';
......
......@@ -29,6 +29,7 @@
<form action="../../../api/merch/buy.php" method="post">
<input type="hidden" name="merchId" value="<?= $merch['merchandise_id'] ?>">
<input type="hidden" name="userId" value="<?= $data['user_id'] ?>">
<input type="hidden" name="email" value="<?= $data['email'] ?>">
<button type="submit" name="buyMerch">Buy</button>
</form>
</div>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment