Advertisement
DragonOsman

quote.php and helper files for quote in pset7

Dec 17th, 2016
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. <?php
  2.  
  3.     require("../includes/config.php");
  4.    
  5.     render("submit_symbol.php", ["title" => "Submit a Symbol"]);
  6.  
  7. ?>
  8.  
  9. <form action="display_price.php" method="post">
  10.     <fieldset>
  11.         <legend>Symbol Information</legend>
  12.         <input type="text" name="symbol" placeholder="Enter Symbol Here" value=""/>
  13.         <input type="submit" value="Display Price"/>
  14.     </fieldset>
  15. </form>
  16.  
  17. <?php
  18.  
  19.     require("../includes/config.php");
  20.    
  21.     $stock = lookup($_POST["symbol"]);
  22.    
  23.     if ($stock === false)
  24.     {
  25.         apologize("That's an invalid symbol!");
  26.     }
  27.    
  28.     printf("<p style='text-align:center;'>A share of %s is worth <b>$%s</b>\n</p>", $stock["name"], number_format($stock["price"], 1));
  29.    
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement