Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2014
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. <?php
  2. $city = $_GET['city'];
  3. ?>
  4. <h1>Welcome to Population Data Online</h1>
  5. <?
  6. $cities = array(
  7.   'Philadelphia' => 1548000,
  8.   'New York' => 8337000,
  9.   'Los Angeles' => 3858000,
  10.   'Seattle' => 634535,
  11.   'Boston' => 636479,
  12. );
  13. if ($city && isset($cities[$city])) {
  14.   print '<p>The population of <strong>' . $city . '</strong> is <strong>' . $cities[$city] . '</strong></p>';
  15. }
  16.  
  17. ?>
  18. <h2>Our Cities</h2>
  19. <ul>
  20. <?php
  21.   foreach ($cities as $name => $value) {
  22.     print '<li><a href="/jody/population.php?city=' . $name  . '">' . $name
  23.     . '</a></li>';
  24.   }
  25. ?>
  26. </ul>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement