SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member hashour's Avatar
    Join Date
    Apr 2004
    Location
    Canada
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    submit form $PHP_SELF

    can anyone please tell me when i run this code on winXP + apache server and PHP it works, when i run it on a red hat Linux with apache and PHP the submit does not work....

    <form action ="<? echo $PHP_SELF ?>" method =" POST">

    <? if ($go) echo "hello $name"; ?>

    <input type="text" name="name" size="10" maxlength="10"><br>
    <input name="go" value="go" type="submit">

    </form>

    When i view the source of the page on linux, i can't see any of the php code,
    and the action = " "

    thanks for any help or suggestions

  2. #2
    SitePoint Member
    Join Date
    Apr 2004
    Location
    Orange County
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    gotta use the global arrays.
    use $_SERVER['PHP_SELF'] instead of $PHP_SELF plus its more secure to use the superglobal arrays rather than globals ($_GET,$_COOKIE,$_POST,$_SERVER,$_SESSION,$_FILES)

  3. #3
    SitePoint Wizard
    Join Date
    Oct 2001
    Location
    Tucson, Arizona
    Posts
    1,858
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also, use full open tags (<?php as opposed to <?) and check variables properly:
    PHP Code:
    // This is good

    if (false != isset($_POST['go']))
    {
        
    // ...
    }

    // This is bad

    if ($go)
    {
        
    // ...


  4. #4
    SitePoint Member hashour's Avatar
    Join Date
    Apr 2004
    Location
    Canada
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thx for the suggestions, tried them, still does not work...

    what i find weird is when i look at the page source after it loaded, i see the following:
    <form action =" " method =" POST">

    my guess its the source of the problem, not sure why it does that!!!

  5. #5
    SitePoint Member hashour's Avatar
    Join Date
    Apr 2004
    Location
    Canada
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    actually ignore my last post.... it worked... thx guys...

    just one last thing related to this issue, why??? why it worked on wn, not on Linux... although i got this from 2 different books!!!!

  6. #6
    SitePoint Member
    Join Date
    Apr 2004
    Location
    Orange County
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    different php settings on the two different machines

  7. #7
    SitePoint Wizard
    Join Date
    Oct 2001
    Location
    Tucson, Arizona
    Posts
    1,858
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It has nothing to do with Windows or Linux. The exact configuration directives involved in this case are register_globals and short_open_tag, both of which should be off in an optimal configuration.

  8. #8
    SitePoint Member hashour's Avatar
    Join Date
    Apr 2004
    Location
    Canada
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thx for the info guys!


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
  •