View Full Version : is any function/property in PHP like js:location.href
leonidassavvides
02-08-2009, 03:17 PM
is any function/property in PHP like js:location.href, to give the current url, to get compared, for producing highlight menu items ?
a local php server in a laptop needs internet connection to work locally only ?
I got the redirect part, but can you rephrase the rest of it?
To redirect in php:
<?php
header("Location: location.php");
?>
leonidassavvides
02-08-2009, 05:51 PM
I do NOT Redirection but a statement that assigns current URL To a var like javascript's location.href ?
So you have a button - and when you click it it will take you some where? Or, it will tell you the URL of the page your currently at?
techietim
02-08-2009, 08:08 PM
Will this variable be good for you?
$_SERVER['SCRIPT_NAME']
djr33
02-08-2009, 08:36 PM
More generally, any information you need similar to that (at least that is available in PHP) should be somewhere in one of these variables:
http://www.php.net/manual/en/reserved.variables.php
Look at $_SERVER.
(post, get, cookie, session, etc. are useful too, but those are for other purposes than general information about the environment.)
leonidassavvides
02-09-2009, 10:05 AM
Will this variable be good for you?
$_SERVER['SCRIPT_NAME']
'SCRIPT_NAME' what is it ? to get current url , what must be ?
Schmoopy
02-09-2009, 10:48 AM
There is a list here: http://uk2.php.net/reserved.variables.server
$_SERVER['SCRIPT_NAME'] = Contains the current script's path. This is useful for pages which need to point to themselves. The __FILE__ constant contains the full path and filename of the current (i.e. included) file.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.