Quick Reference for PHP

From Free Knowledge Base- The DUCK Project: information for everyone
Revision as of 14:24, 18 April 2014 by Admin (Talk | contribs)

Jump to: navigation, search

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