Get Page URI / URL

Get just the domain name $_SERVER[‘HTTP_HOST’] gives you the domain name through which the current request is being fulfilled Get site URL Get full page URL (domain name + page + any arguments) Page URL (With Arguments) Stripping Page URL Getting URL without the arguments Getting just the URL arguments Will get everything after the […]

Read More

Blank page until its loaded

Put this near the top of the head section <!– CAUSE PAGE TO FADE IN ONCE LOADED – 1ST PART –> <style> body { display: none; } </style> <!– LOAD JQUERY LIBRARIES –> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script> <!–Should be first script imported/first script on the page–> <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/smoothness/jquery-ui.css" type="text/css" media="all" /> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js" type="text/javascript"></script> Put […]

Read More

Do not cache page

  <?php //SET PAGE TO NOT BE CACHED header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1. header("Pragma: no-cache"); // HTTP 1.0. header("Expires: 0"); // Proxies    

Read More

Reload page

Reload the current page Form reloads current page Link reloads current page Reload current page but with post values stripped Using javascript Periodic Refresh

Read More

Getting URL Arguments

Get an argument GET only using $_GET POST only using $POST GET or POST using $_REQUEST Did GET or POST occur Example GET URL Start with an ‘?’, then separate other values with an ‘&’ To read: Example For POST Parameters Sanitise Them!!! htmlentities() converts things like < > ” \ etc into HTML strings like […]

Read More

Redirect and Reload

Before outputting page content Note this must be before any html headers are sent (i.e. in php code before html output) Redirect to a new page Reload the current page The php header function Redirect with check you’re not already on target page If you’ve outputted some page content Using a META tag is the […]

Read More

Close Browser Window

PHP is executed at the server-side and thus does not know about clients, browsers or windows of those browsers. Some options though: Close button Close using java script

Read More