View Full Version : Php_self
08-26-2006, 08:06 AM
<FORM METHOD="POST" ACTION="<? echo $_SERVER['PHP_SELF']; ?>">
if i have this code in my CallerFile.php
is it similar to
<FORM METHOD="POST" ACTION="CallerFile.php">
if not may i know the differences
if yes which is better?
08-26-2006, 10:32 AM
Yes it's the same
$SERVER['PHP_SELF'] is a superglobal which contains the page which is opened.
So in your case : if you visit callerfile.php
$SERVER['PHP_SELF'] will automaticly get the url visited, so in this case it will contain : /callerfile.php
This variable is usefull when you create installscripts. If people then install your script in the directory 'newscript/'
you should change your link of every form to /newscript/callerfile.php but with the $server['php_self'] it automaticly posts to the page /newscripts/callerfile.php
I hop this is clear because i'm not a good explainer
08-26-2006, 10:37 AM
Shouldn't that be $_SERVER['PHP_SELF'] (i.e. dollar underscore …)
08-26-2006, 11:35 AM
yes sorry forgot to typ it lol
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.