Difference between revisions of "Quick Reference for PHP"

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
Line 3: Line 3:
 
See also: [[PHP Function Reference]]
 
See also: [[PHP Function Reference]]
  
<?
+
  <?
  header('Location: http://members.robotz.com/');
+
    header('Location: http://members.robotz.com/');
?>
+
  ?>
  
 +
== Read Query String ==
  
 +
  <?
 +
    $qString = $_SERVER['QUERY_STRING'];
 +
    $qString = preg_replace('#[^a-zA-Z0-9_-]#', '', $qString);
 +
    print "QUERYSTRING= $qString<BR>";
 +
    if ($qString == "") $qString = "home";
 +
    if ($qString == "home") {
 +
      ?><i>Viewing the HOME PAGE</i></a> <?
 +
    } elseif ($qString == "other") {
 +
      ?><i>Viewing some other page</i></a> <?
 +
    }
  
 +
&nbsp;
  
 
[[Category:Computer Technology]]
 
[[Category:Computer Technology]]
 
[[Category:Programming]]
 
[[Category:Programming]]
 
[[Category:PHP]]
 
[[Category:PHP]]

Revision as of 15:24, 18 April 2014

Redirect with PHP

See also: PHP Function Reference

 <?
   header('Location: http://members.robotz.com/');
 ?>

Read Query String

 <?
   $qString = $_SERVER['QUERY_STRING'];
   $qString = preg_replace('#[^a-zA-Z0-9_-]#', , $qString);
   print "QUERYSTRING= $qString
"; if ($qString == "") $qString = "home"; if ($qString == "home") {  ?>Viewing the HOME PAGE</a> <? } elseif ($qString == "other") {  ?>Viewing some other page</a> <? }