SitePoint Sponsor

User Tag List

Results 1 to 16 of 16

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Feb 2005
    Location
    Aveiro, Portugal
    Posts
    165
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    $_GET works, $_POST doesn't

    Hi all,

    I installed a while back Apache2+mysql5.0+php5.2 on my compute (windows xp)

    I thought everything went well, but I can't access any $_POST variables.
    I can't find anything wrong in my php.ini.

    Funny thing is I can access $_GET variables.

    Thankx for any help on this.

    Mario Ramos
    Yours truely
    Mário Ramos

  2. #2
    SitePoint Member
    Join Date
    Jul 2006
    Location
    jhb, south africa
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try
    PHP Code:
    print_r($_GET);
    print_r($_POST);
    print_r($_REQUEST); 
    I'm thinking perhaps because Ver 5 you might need to use $_REQUEST global variable.
    whatever the mind
    can conceive and believe
    it can achieve

  3. #3
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    post you phpinfo() result
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  4. #4
    SitePoint Evangelist
    Join Date
    Jun 2003
    Location
    Melbourne, Australia
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mjpr View Post
    I can't access any $_POST variables.
    Er... you did send some didn't you?
    Quote Originally Posted by <h1>
    I'm thinking perhaps because Ver 5 you might need to use $_REQUEST global variable
    None of the superglobals has changed in PHP5.
    Zealotry is contingent upon 100 posts and addiction 200?

  5. #5
    SitePoint Zealot
    Join Date
    Feb 2005
    Location
    Aveiro, Portugal
    Posts
    165
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I have a simple form:

    <htmlcode>
    <FORM METHOD="POST" ACTION="test.php">
    <INPUT TYPE="text" NAME="txt1"><br>
    <INPUT TYPE="text" NAME="txt2"><br>
    <INPUT TYPE="submit" value="Enviar">
    </FORM>
    </htmlcode>

    and the processing script:

    <phpcode>
    echo "GET: ".print_r($_GET)."<br>";
    echo "POST: ".print_r($_POST)."<br>";
    echo "REQUEST: ".print_r($_REQUEST)."<br>";
    </phpcode>

    The output is:
    Array ( ) GET: 1
    Array ( ) POST: 1
    Array ( [box1] => ) REQUEST: 1

    in other words, empty!



    If I change the form method to GET, the result is:

    Array ( [txt1] => value1 [txt2] => value2 ) GET: 1
    Array ( ) POST: 1
    Array ( [txt1] => value1 [txt2] => value2 [box1] => ) REQUEST: 1

    The problem is just concerning POST.

    Yes, I did send something through the textboxes...

    As requested, a link to my phpinfo. It's just a page where I pasted my phpinfo. It was taken from my pc. It has nothing to do with the server it's on.
    <link>http://alunos.fam.ulusiada.pt/~f32000047/test.php.htm</link>
    Yours truely
    Mário Ramos

  6. #6
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mjpr View Post
    If I change the form method to GET, the result is:

    Array ( [txt1] => value1 [txt2] => value2 ) GET: 1
    Array ( ) POST: 1
    Array ( [txt1] => value1 [txt2] => value2 [box1] => ) REQUEST: 1
    Wheres the [box1] key coming from ??
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  7. #7
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    i don't see any problems in your PHP info.

    do you have access to editing test.php? if so, comment out all of the current script, then put this:
    PHP Code:
    <?
    echo "txt1: ".$_POST['txt1'];
    echo 
    "\n<br>txt2: ".$_POST['txt2'];
    ?>
    and if it doesn't work, report back with all of both scripts (blank out the sensitive data).
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  8. #8
    SitePoint Wizard bronze trophy Kailash Badu's Avatar
    Join Date
    Nov 2005
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The code is working fine on my machine. BTW, you are using the release candidate version of PHP which might show(though not very likely) some buggy behavior. Try reverting back to a stable version or checking the bug database at php.net

  9. #9
    SitePoint Wizard bronze trophy Kailash Badu's Avatar
    Join Date
    Nov 2005
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wheres the [box1] key coming from ??
    may be from cookies...?

  10. #10
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Kailash Badu View Post
    may be from cookies...?
    Cant believe I didnt think of that
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  11. #11
    SitePoint Zealot
    Join Date
    Feb 2005
    Location
    Aveiro, Portugal
    Posts
    165
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Well, I'm not at home right now, so won't be able to test it.

    Don't know what/where [box1] is comming from.
    Yours truely
    Mário Ramos

  12. #12
    SitePoint Zealot
    Join Date
    Feb 2005
    Location
    Aveiro, Portugal
    Posts
    165
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Could it have something to do with variables order?
    Mine are "GPCS".
    Yours truely
    Mário Ramos

  13. #13
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mjpr View Post
    Could it have something to do with variables order?
    Mine are "GPCS".
    So are mine, and Ive tried you script on 3 of my servers works fine on all of them, not sure what to suggest other than re-install the latest stable version.
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  14. #14
    SitePoint Wizard bronze trophy Kailash Badu's Avatar
    Join Date
    Nov 2005
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mjpr
    Could it have something to do with variables order?
    Mine are "GPCS".
    I don't think so.

    With this setting, cookies and Server variables would overwrite get and post variables should the variable name conflict occur. If get variables show up fine, there is hardly any possibility that post variables would be overwritten.

  15. #15
    SitePoint Zealot
    Join Date
    Feb 2005
    Location
    Aveiro, Portugal
    Posts
    165
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Ok Guys,

    Thanks for all your input.
    I will try to re-install the latest stable version and I'll get back to you.
    Yours truely
    Mário Ramos

  16. #16
    SitePoint Zealot
    Join Date
    Feb 2005
    Location
    Aveiro, Portugal
    Posts
    165
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi all,

    I removed my php5.2 installation and installed php5.1.6

    But I'm still having the same problem.

    Here are links to my httpd.conf and php.ini files

    <link>
    http://alunos.fam.ulusiada.pt/~f32000047/httpd.conf
    </link>

    <link>
    http://alunos.fam.ulusiada.pt/~f32000047/php.ini
    </link>

    Maybe something wrong in them...
    Thankx
    Yours truely
    Mário Ramos


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
  •