<?php require_once __DIR__ . '/config.php'; require_once __DIR__ . '/Poll.php'; try { $poll = new \MyApp\Poll(); } catch (Exception $e) { echo $e->getMessage(); exit; } if ($_SERVER['REQUEST_METHOD'] === 'POST') { $poll->post(); } $err = $poll->getError(); ?> <!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <title>Poll</title> <link rel="stylesheet" href="styles.css"> <head> <body> <?php if (isset($err)) { ?> <div class="error"><?php echo h($err); ?> </div> <?php
<?php require_once __DIR__ . '/config.php'; require_once __DIR__ . '/Poll.php'; try { $poll = new \MyApp\Poll(); } catch (Exception $e) { echo $e->getMessage(); exit; } $results = $poll->getResults(); ?> <!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <title>Poll Result</title> <link rel="stylesheet" href="styles.css"> <head> <body> <h1>Result ...</h1> <div class="row"> <?php for ($i = 0; $i < 3; $i++) { ?> <div class="box" id="box_<?php echo h($i); ?> "><?php echo h($results[$i]); ?>