Posted By

stephcode on 11/10/10


Tagged

get php


Versions (?)

Simple PHP $_GET variable


 / Published in: PHP
 

  1. home.php:
  2.  
  3. <p><a href="city.php?city=New_York_City">New York</a></p>
  4.  
  5. <p><a href="city.php?city=Boston">Boston</a></p>
  6.  
  7. city.php:
  8.  
  9. <p>Welcome to <?php echo $_GET['city'] ?> !</p>
  10.  
  11. OR -
  12.  
  13. home.php:
  14.  
  15. <p><a href="city.php?city=<?php echo urlencode("New York City"); ?>">New York</a></p>
  16.  
  17. <p><a href="city.php?city=Boston">Boston</a></p>
  18.  
  19. <p><a href="city.php?city=Rockville">Rockville</a></p>
  20.  
  21. city.php:
  22.  
  23. <p>Welcome to <?php echo urldecode($_GET['city']); ?> !</p>

Report this snippet  

You need to login to post a comment.