Results 1 to 3 of 3

Thread: action=\"$_SERVER[PHP_SELF]\">

  1. #1
    Join Date
    Aug 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default action=\"$_SERVER[PHP_SELF]\">

    i will be very pleased if anyone will explain me the meaning of the syntax above. thank you.

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    It's probably sending the form data back to the same page it is on.


    http://php.net/manual/en/reserved.variables.server.php
    The filename of the currently executing script, relative to the document root. For instance, $_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 (i.e. included) file. If PHP is running as a command-line processor this variable contains the script name since PHP 4.3.0. Previously it was not available.
    Corrections to my coding/thoughts welcome.

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    While I'm not positive this is entirely valid, setting the action to an empty string does the same thing:
    <form action="" .....>

    (In other cases, those server variables are useful, but if you aren't doing anything fancy with the action, a "blank" action should be fine.)

    You could also remove all "get" variables like this:
    <form action="?" ....>

    That's actually what I use on most of my forms, and the only problem is that there's an extra (annoying) question mark at the end. But usually this helps because it gives a new URL for the submitted form.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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
  •