Quick Reference for PHP

Revision as of 15:25, 18 April 2014 by Admin (Talk | contribs)

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<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> <?
   }

 

Last modified on 18 April 2014, at 15:25