Yet another $_POST Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Collie

    Yet another $_POST Problem

    PHP version 5.1.1
    Apache 2.0.55.

    code;
    index.html

    <html>
    <head>
    <title>Untitl ed Document</title>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1">
    </head>
    <body>
    <form action="foo.php " method="post" name="form">
    <input name='username' type="text" value="colin">
    <input name="email" type="text" value="crona... @email.com">
    <input name="submit" type="submit" value="submit me!">
    </form>
    </body>
    </html>

    foo.php

    <?php
    echo "We are on foo.php";
    echo "<br>";
    $username = isset($_POST['username']) ? $_POST['username'] :
    NULL;
    $email = isset($_POST['email']) ? $_POST['email'] : NULL;
    echo $username;
    echo $email;
    ?>

    Output;
    We are on foo.php

    So simple. So easy. Yet $username and $email will not get printed.

    All my forms worked perfectly last week (boo-hoo, I know), but now only
    GET will work on even the simplest of forms. And I would rather not go
    through every form and change them to get.

    Cause it's past midnight on my second day of trying to fix this I have
    to ask.......
    Any ideas?
    Did I change a php.ini setting in my sleep?

    /* It can take hours to find the problem and a second to fix it. */

  • Rainman

    #2
    Re: Yet another $_POST Problem

    Try a

    print_r($_POST) ;

    and see what you get. If nothing, then NULLs will be assigned as per
    your code. This also probably points to a php.ini or other PHP or
    Apache setting that is preventing POST variables, because AFAICT, you
    code appears to be correct.
    Mark

    Comment

    • Collie

      #3
      Re: Yet another $_POST Problem

      cheers Mark.

      I have tried that allright. For GET it populates the Array but for
      POST the array is empty.
      Once I got all my text forms working correctly I moved onto file
      upload. The only thing I can remember changing is the maximum file
      size allowed in php.ini. But the fact that it worked and now doesn't
      means I changed something else. But I can't for the life of me figure
      out what it is. Anything specific I should look for? php.ini and
      apache config looks fine. But I could be looking through rose tinted
      glasses.

      Thanks again mate.

      Comment

      • Collie

        #4
        Re: Yet another $_POST Problem

        Well, I answered my own question.
        By changing
        post_max_size = 1000000000M to
        post_max_size = 100000000M
        all post data was sent.

        The reason I changed it was that I thought it worked in conjunction
        with
        upload_max_file size

        but this doesn't seem to be the case. File upload will still upload
        files of a gig.

        Cool.

        Thanks Mark.

        Comment

        • Gordon Burditt

          #5
          Re: Yet another $_POST Problem

          >By changing[color=blue]
          >post_max_siz e = 1000000000M to
          >post_max_siz e = 100000000M
          >all post data was sent.
          >
          >The reason I changed it was that I thought it worked in conjunction
          >with
          >upload_max_fil esize
          >
          >but this doesn't seem to be the case. File upload will still upload
          >files of a gig.[/color]

          Don't you think that 100,000 GIGABYTES is a little excessive for
          POST data? Besides, it's apparently taking it as a signed 32-bit
          number anyway, and if it's negative, it won't allow any.

          Gordon L. Burditt

          Comment

          • Stan McCann

            #6
            Re: Yet another $_POST Problem

            "Collie" <cronayne@gmail .com> wrote in
            news:1133828833 .907110.122590@ f14g2000cwb.goo glegroups.com:
            [color=blue]
            > PHP version 5.1.1
            > Apache 2.0.55.
            >
            > code;
            > index.html
            >
            > <html>
            > <head>
            > <title>Untitl ed Document</title>
            > <meta http-equiv="Content-Type" content="text/html;
            > charset=iso-8859-1">
            > </head>
            > <body>
            > <form action="foo.php " method="post" name="form">
            > <input name='username' type="text" value="colin">
            > <input name="email" type="text" value="crona... @email.com">
            > <input name="submit" type="submit" value="submit me!">
            > </form>
            > </body>
            > </html>
            >
            > foo.php
            >
            > <?php
            > echo "We are on foo.php";
            > echo "<br>";
            > $username = isset($_POST['username']) ? $_POST['username'] :
            > NULL;
            > $email = isset($_POST['email']) ? $_POST['email'] : NULL;
            > echo $username;
            > echo $email;
            > ?>
            >
            > Output;
            > We are on foo.php
            >
            > So simple. So easy. Yet $username and $email will not get printed.
            >
            > All my forms worked perfectly last week (boo-hoo, I know), but now
            > only GET will work on even the simplest of forms. And I would
            > rather not go through every form and change them to get.
            >
            > Cause it's past midnight on my second day of trying to fix this I
            > have to ask.......
            > Any ideas?
            > Did I change a php.ini setting in my sleep?
            >
            > /* It can take hours to find the problem and a second to fix it. */
            >
            >[/color]

            isset is not the function you want to use. Try empty().

            --
            Stan McCann "Uncle Pirate" http://stanmccann.us/pirate.html
            Webmaster/Computer Center Manager, NMSU at Alamogordo
            http://alamo.nmsu.edu/ There are 10 kinds of people.
            Those that understand binary and those that don't.

            Comment

            Working...