SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    $server['php_self'] clear up

    Does the following code once the form has been submitted return to the same page:

    <form action="<?=$server['php_self']?>">
    </form>

    Can anyobody explain how the following line of code works and what else can be used in replace of 'php_self' and what this would actually do please?: <?=$server['php_self']?>

    Regards
    p_h_p

  2. #2
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,001
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    That one no, but this one yes
    PHP Code:
    <form action="<? echo $_SERVER['PHP_SELF']?>">
    </form>
    It $_SERVER["PHP_SELF"] will return the the filename of the currently executing script.
    -- Jelena --

  3. #3
    SitePoint Wizard bronze trophy Kailash Badu's Avatar
    Join Date
    Nov 2005
    Posts
    2,561
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Seems , You do not know enough about $_SERVER. It is a kind of autoglobal variable and You can use anywhere in your PHP application to extract information about the server on which Your application in running. Some $_SERVER varialbles are

    $_SERVER['PHP_SELF'] = filename of the current page

    $_SERVER['SERVER_NAME']
    The name of the server host under which the current script is executing. If the script is running on a virtual host, this will be the value defined for that virtual host.

    Find complete list at
    http://www.php.net/manual/en/reserve...riables.server

  4. #4
    SitePoint Addict
    Join Date
    May 2006
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Did you guys ever get php self to open the same page again after the item was executed? What are you using? Thanks.

  5. #5
    Non-Member
    Join Date
    Apr 2006
    Location
    Scotland
    Posts
    325
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $_SERVER[PHP-SELF'] takes you to the same page, so whats the problem?

    BTW I posted the full code in your other topic

  6. #6
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by 1Jen View Post
    Did you guys ever get php self to open the same page again after the item was executed? What are you using? Thanks.
    view the html source and see what your problem is.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •