예제 #1
0
  <option>2</option>
  <option>3</option>
  <option>4</option>
  <option>5</option>
</select>
<button type="submit" name="purchase" class="btn btn-default" style="margin-left: 80px;">Purchase</button>
</form>
</div>
<?php 
    if (isset($_POST['purchase'])) {
        $sale = new SALE();
        $stmt = $sale->runQuery("SELECT * FROM sale WHERE user_id=" . $userRow['user_id'] . " and ticket_id=" . $_GET['tid']);
        $stmt->execute();
        $saleRow = $stmt->fetch(PDO::FETCH_OBJ);
        if ($saleRow) {
            $sale->update($userRow['user_id'], $_GET['tid'], $_POST['quantity']);
            echo "Updated: " . $ticketRow->name;
        } else {
            $sale->register($userRow['user_id'], $ticketRow->ticket_id, $_POST['quantity']);
            echo "Purchased: " . $ticketRow->name;
        }
    }
}
?>


    </div>

</div>

<script src="bootstrap/js/bootstrap.min.js"></script>