Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Apr 2011
    Posts
    81
    Member #
    27344
    Liked
    3 times
    Normally when using forms we do as follows:
    <form action="this_script.php" method="post">
    </form>

    For instance, if we use action="$_SERVER['PHP_SELF']" in a script at the address http://example.com/test.php/foo.bar
    would be /test.php/foo.bar. The __FILE__ constant contains the full path and filename of the current script

    Is there something in php which returns only the script name without any folder names like so?
    /foo.bar

    thank you for any help.

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,717
    Member #
    5580
    Liked
    718 times
    See what this gives you ... it should display "foo.bar" ...

    $script = substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
    echo $script;
    onlinespider likes this.


  4. #3
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Why isn't php_self working for you? It gives the absolute path, so posting to that should work fine.

  5. #4
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,717
    Member #
    5580
    Liked
    718 times
    Also note ...

    If you don't specify an action, the form posts to itself ..

    <form method="post">

    Whatever script it's in, get the post.
    onlinespider likes this.



Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:54 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com