topical media & game development

talk show tell print

basic-web-php-PHP-Example02.php / php



  <?php
  
  // Print document header
  
  // If content header has not been sent,
  //   send it
  if (!headers_sent()) {
    header('Content-type: text/html');
  }
  
  print <<<HTML
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  <html>
  <head>
    <title>POST/GET Variable Dump</title>
  </head>
  <body>
  
  HTML;
  
  // If there is POST data, dump it
  //  else display "No Data"
  if (isset(_POST) && count(_POST) != 0) {
    print "<h2>POST Data</h2>\n";
    print "<pre>\n<p>\n";
  
    var_dump(_POST);
  
    print "</pre>\n</p>\n";
  } else {
    print "<h2>No POST Data</h2>\n";
  }
  
  // If there is GET data, dump it
  //  else display "No Data"
  if (isset(_GET) && count(_GET) != 0) {
    print "<h2>GET Data</h2>\n";
    print "<pre>\n<p>\n";
  
    var_dump(_GET);
  
    print "</pre>\n</p>\n";
  }  else {
    print "<h2>No GET Data</h2>\n";
  }
  
  // Close document
  print <<<HTML
  </body>
  </html>
  
  HTML;
  
  ?>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.