Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- quote.php:
- <?php
- require("../includes/config.php");
- render("submit_symbol.php", ["title" => "Submit Symbol"]);
- ?>
- submit_symbol.php:
- <form action="get_price.php" method="post">
- <fieldset>
- <legend>Symbol Information</legend>
- <input type="text" name="symbol" placeholder="Enter Symbol Here" value=""/>
- <br/><br/>
- <input type="submit" class="btn btn-default" value="Display Price"/>
- </fieldset>
- </form>
- get_price.php
- <?php
- require("../includes/config.php");
- $stock = lookup($_POST["symbol"]);
- if ($stock === false)
- {
- apologize("That's an invalid symbol!");
- }
- render("display.php", ["stock" => $stock, "title" => "Stock Price"]);
- ?>
- display.php:
- <div>
- <p>A share of <?= $stock["name"] ?> (<?= $stock["symbol"] ?>) is worth $<?= number_format($stock["price"], 2) ?>.</p>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement