SitePoint Sponsor

User Tag List

Results 1 to 15 of 15

Thread: $php_self

Hybrid View

  1. #1
    SitePoint Guru DeNasio's Avatar
    Join Date
    May 2001
    Posts
    830
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    $php_self

    Anyone else noticed that you cannot use

    <FORM ACTION="<?php echo $PHP_SELF; ?>" METHOD="POST">

    in Netsape? With IE it works fine, the script just calls itself, but with Nescape I get the following error message:

    "Method Not Allowed

    The requested method POST is not allowed for the URL /index.html."

  2. #2
    SitePoint Member atem451's Avatar
    Join Date
    May 2001
    Location
    Berlin
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I recognized that as well, and I dont understand it.
    I get around it with simply always reading the value of $PHP_SELF in an variable first.
    Can anybody explain this?
    Footbag: Spread the Spirit

  3. #3
    SitePoint Evangelist =X='s Avatar
    Join Date
    Jun 2001
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I actually don't have that problem. I used netscape6 to test it...maybe you use 4.7 (wich causes troubles on about everything you do)?
    otherwhise you could try this:
    <form method="post" action="<?php print($PHP_SELF); ?>">
    instead of yours...although I doubt it would do anything else, since it should do the same...

    you prolly tested it on 4.7...I hate that browser...

  4. #4
    SitePoint Columnist Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,066
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That doesn't make any sense at all. PHP does things at the server side - it shouldn't affect the client in any way. In this case the HTML sent to the browser should look like this:

    <form method="post" action="script.php">

    Nothing wrong with that at all. The error message you are getting suggests that you are trying to post to an .html file rather than a .php file - unless your server is set up to accept posts to html file (most aren't) it will result in that error.

  5. #5
    SitePoint Zealot sifuhall's Avatar
    Join Date
    Jun 2001
    Location
    out of the sidehatch
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Make sure you don't accidentally have a space before $PHP_SELF.

    For example, in the html it would look like this . . .


    Code:
    <form method="post" action=" index.php">
    This would also cause the "Method Not Allowed" error.

  6. #6
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    agreed, this has nothing to do with Netscape OR IE. It's a server side thing.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  7. #7
    SitePoint Zealot New Oddity's Avatar
    Join Date
    Jun 2001
    Location
    Georgia
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The $PHP_SELF variable seems to have a case sensitive identifier. Try putting $PHP_SELF instead $php_self...
    --Odd
    "We all live in a yellow subroutine."
    "Some call it insanity; I call it inspiration!"

  8. #8
    SitePoint Zealot cokeman's Avatar
    Join Date
    Dec 2000
    Location
    So. California
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: $php_self

    Originally posted by DeNasio
    Anyone else noticed that you cannot use

    <FORM ACTION="<?php echo $PHP_SELF; ?>" METHOD="POST">

    in Netsape? With IE it works fine, the script just calls itself, but with Nescape I get the following error message:

    "Method Not Allowed

    The requested method POST is not allowed for the URL /index.html."
    Are you echoing that line in a function? If so, you need to declare $PHP_SELF as global. If you don't, $PHP_SELF is undeclared and the line that gets sent is:

    <form action="" method="post">

    IE's default behavior for a blank action is to send the form data to the same page. Netscape chokes with the "method not allowed" error.

  9. #9
    SitePoint Evangelist =X='s Avatar
    Join Date
    Jun 2001
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if this is true then PHP isn't browser independent...damn

  10. #10
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP is entirely browser independent. The only difference is how IE and NS handle poorly coded HTML. It's like saying that PHP causes problems in Netscape because you ouput bad table tags. jeez.

  11. #11
    SitePoint Evangelist =X='s Avatar
    Join Date
    Jun 2001
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if with the same php code 2 different browsers give a different result, then I think it's not browser independent...
    no matter what it caused

  12. #12
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    There is a DIFFERENCE between HTML and PHP, Jesus Christ

    Whatever..

  13. #13
    SitePoint Evangelist =X='s Avatar
    Join Date
    Jun 2001
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes I see your point, it's indeed causes by html and not the php
    sorry for being a p.i.t.a.

  14. #14
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    IE will default to the same page if no action is given, thus if you used $php_self and not $PHP_SELF IE would work okay and Netscape would break.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  15. #15
    SitePoint Guru DeNasio's Avatar
    Join Date
    May 2001
    Posts
    830
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Re: $php_self

    Are you echoing that line in a function?
    Yep, I think that's it! I'm using it in a function! Thanks!


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
  •