problems with POST

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

    problems with POST

    Hi,

    The script below *used* to work. I have only just set up a
    server, PHP etc again on my Win98 system and now it doesn't?

    On first loading this page, you would have

    $p =

    and the button image below it.
    On clicking the button the same page would reload but pass the hidden values
    (r=w & p=f)
    so that the first line of the page would then have

    $p = f

    This no longer works???

    <?php
    echo "<html><bod y>";
    echo "\$p = $p<br><br>"; //###
    $str = <<<HTM
    <head>
    </head>
    <body>
    <form action="" method="post">
    <input type="hidden" name="r" value="w">
    <input type="hidden" name="p" value="f">
    <input type="image" src="http://home/images/faq-up.gif" border="0"
    height="22" width="77">
    </form>
    </body>
    </html>
    HTM;
    echo $str;
    ?>


    on printing the $_ENV variables along with the the above script I find the
    following :

    QUERY_METHOD POST
    REQUEST_METHOD POST
    FORM_P f
    FORM_R w

    Is there something I haven't enabled in my
    setup of PHP that is stopping this from working now?

    Or has something changed with PHP, so that I have to do this another way?

    many thanks

    mori



  • Gordon Burditt

    #2
    Re: problems with POST

    >The script below *used* to work. I have only just set up a[color=blue]
    >server, PHP etc again on my Win98 system and now it doesn't?[/color]

    A variable passed from HTML by the POST method is $_POST['r'] or
    $_POST['p'], *not* $r or $p. (Also see $_GET for variables
    passed by the GET method). Fix your script. Do not turn
    on "register_globa ls".

    Gordon L. Burditt

    [color=blue]
    >
    >On first loading this page, you would have
    >
    >$p =
    >
    >and the button image below it.
    >On clicking the button the same page would reload but pass the hidden values
    >(r=w & p=f)
    >so that the first line of the page would then have
    >
    >$p = f
    >
    >This no longer works???
    >
    ><?php
    >echo "<html><bod y>";
    >echo "\$p = $p<br><br>"; //###
    >$str = <<<HTM
    ><head>
    ></head>
    ><body>
    ><form action="" method="post">
    > <input type="hidden" name="r" value="w">
    > <input type="hidden" name="p" value="f">
    > <input type="image" src="http://home/images/faq-up.gif" border="0"
    >height="22" width="77">
    ></form>
    ></body>
    ></html>
    >HTM;
    >echo $str;
    >?>
    >
    >
    >on printing the $_ENV variables along with the the above script I find the
    >following :
    >
    >QUERY_METHOD POST
    >REQUEST_METH OD POST
    >FORM_P f
    >FORM_R w
    >
    >Is there something I haven't enabled in my
    >setup of PHP that is stopping this from working now?
    >
    >Or has something changed with PHP, so that I have to do this another way?
    >
    >many thanks
    >
    >mori
    >
    >
    >[/color]


    Comment

    • moriman

      #3
      Re: problems with POST

      wow, thx for the *very* quick reply ;-)

      tried changing the
      echo "\$p = $p<br><br>";

      to

      echo "\$p = " . $_POST['p'] . "<br><br>";

      but still not working :(

      mori

      "Gordon Burditt" <gordonb.ari4j@ burditt.org> wrote in message
      news:11ok7r8qgj mg89a@corp.supe rnews.com...[color=blue][color=green]
      > >The script below *used* to work. I have only just set up a
      > >server, PHP etc again on my Win98 system and now it doesn't?[/color]
      >
      > A variable passed from HTML by the POST method is $_POST['r'] or
      > $_POST['p'], *not* $r or $p. (Also see $_GET for variables
      > passed by the GET method). Fix your script. Do not turn
      > on "register_globa ls".
      >
      > Gordon L. Burditt
      >
      >[color=green]
      > >
      > >On first loading this page, you would have
      > >
      > >$p =
      > >
      > >and the button image below it.
      > >On clicking the button the same page would reload but pass the hidden[/color][/color]
      values[color=blue][color=green]
      > >(r=w & p=f)
      > >so that the first line of the page would then have
      > >
      > >$p = f
      > >
      > >This no longer works???
      > >
      > ><?php
      > >echo "<html><bod y>";
      > >echo "\$p = $p<br><br>"; //###
      > >$str = <<<HTM
      > ><head>
      > ></head>
      > ><body>
      > ><form action="" method="post">
      > > <input type="hidden" name="r" value="w">
      > > <input type="hidden" name="p" value="f">
      > > <input type="image" src="http://home/images/faq-up.gif" border="0"
      > >height="22" width="77">
      > ></form>
      > ></body>
      > ></html>
      > >HTM;
      > >echo $str;
      > >?>
      > >
      > >
      > >on printing the $_ENV variables along with the the above script I find[/color][/color]
      the[color=blue][color=green]
      > >following :
      > >
      > >QUERY_METHOD POST
      > >REQUEST_METH OD POST
      > >FORM_P f
      > >FORM_R w
      > >
      > >Is there something I haven't enabled in my
      > >setup of PHP that is stopping this from working now?
      > >
      > >Or has something changed with PHP, so that I have to do this another way?
      > >
      > >many thanks
      > >
      > >mori
      > >
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • PeteY48

        #4
        Re: problems with POST

        Don't know much about PHP, but it does appear you are sending "<body>"
        twice, once in line 2 and once in line 7. The one in line 2 should be
        deleted so the "<head>" section of the page comes first. Or you need to
        rearrange the order of your statements.

        Comment

        • moriman

          #5
          Re: problems with POST


          "PeteY48" <peteyoung1@gma il.com> wrote in message
          news:1133128331 .708828.94660@z 14g2000cwz.goog legroups.com...[color=blue]
          > Don't know much about PHP, but it does appear you are sending "<body>"
          > twice, once in line 2 and once in line 7. The one in line 2 should be
          > deleted so the "<head>" section of the page comes first. Or you need to
          > rearrange the order of your statements.
          >[/color]

          Yes, you are right about the double <head>, this was due to shortening the
          script and missing this repeat.
          However, this makes absolutely no difference to the operation of the script.


          Comment

          • Juliette

            #6
            Re: problems with POST

            moriman wrote:[color=blue]
            > wow, thx for the *very* quick reply ;-)
            >
            > tried changing the
            > echo "\$p = $p<br><br>";
            >
            > to
            >
            > echo "\$p = " . $_POST['p'] . "<br><br>";
            >
            > but still not working :(
            >
            > mori
            >
            > "Gordon Burditt" <gordonb.ari4j@ burditt.org> wrote in message
            > news:11ok7r8qgj mg89a@corp.supe rnews.com...
            >[color=green][color=darkred]
            >>>The script below *used* to work. I have only just set up a
            >>>server, PHP etc again on my Win98 system and now it doesn't?[/color]
            >>
            >>A variable passed from HTML by the POST method is $_POST['r'] or
            >>$_POST['p'], *not* $r or $p. (Also see $_GET for variables
            >>passed by the GET method). Fix your script. Do not turn
            >>on "register_globa ls".
            >>
            >>Gordon L. Burditt
            >>
            >>
            >>[color=darkred]
            >>>On first loading this page, you would have
            >>>
            >>>$p =
            >>>
            >>>and the button image below it.
            >>>On clicking the button the same page would reload but pass the hidden[/color][/color]
            >
            > values
            >[color=green][color=darkred]
            >>>(r=w & p=f)
            >>>so that the first line of the page would then have
            >>>
            >>>$p = f
            >>>
            >>>This no longer works???
            >>>
            >>><?php
            >>>echo "<html><bod y>";
            >>>echo "\$p = $p<br><br>"; //###
            >>>$str = <<<HTM
            >>><head>
            >>></head>
            >>><body>
            >>><form action="" method="post">
            >>> <input type="hidden" name="r" value="w">
            >>> <input type="hidden" name="p" value="f">
            >>> <input type="image" src="http://home/images/faq-up.gif" border="0"
            >>>height="22 " width="77">
            >>></form>
            >>></body>
            >>></html>
            >>>HTM;
            >>>echo $str;
            >>>?>
            >>>
            >>>
            >>>on printing the $_ENV variables along with the the above script I find[/color][/color]
            >
            > the
            >[color=green][color=darkred]
            >>>following :
            >>>
            >>>QUERY_METH OD POST
            >>>REQUEST_METH OD POST
            >>>FORM_P f
            >>>FORM_R w
            >>>
            >>>Is there something I haven't enabled in my
            >>>setup of PHP that is stopping this from working now?
            >>>
            >>>Or has something changed with PHP, so that I have to do this another way?
            >>>
            >>>many thanks
            >>>
            >>>mori
            >>>
            >>>
            >>>[/color]
            >>
            >>[/color]
            >
            >[/color]

            Try:

            echo "\$p = " . $HTTP_POST_VARS['p'] . "<br><br>";

            Comment

            • moriman

              #7
              Re: problems with POST


              "Juliette" <jrf_no_spam@jo keaday.net> wrote in message
              news:438a9e1c$0 $64688$dbd45001 @news.wanadoo.n l...[color=blue]
              > moriman wrote:[color=green]
              > > wow, thx for the *very* quick reply ;-)
              > >
              > > tried changing the
              > > echo "\$p = $p<br><br>";
              > >
              > > to
              > >
              > > echo "\$p = " . $_POST['p'] . "<br><br>";
              > >
              > > but still not working :(
              > >
              > > mori
              > >
              > > "Gordon Burditt" <gordonb.ari4j@ burditt.org> wrote in message
              > > news:11ok7r8qgj mg89a@corp.supe rnews.com...
              > >[color=darkred]
              > >>>The script below *used* to work. I have only just set up a
              > >>>server, PHP etc again on my Win98 system and now it doesn't?
              > >>
              > >>A variable passed from HTML by the POST method is $_POST['r'] or
              > >>$_POST['p'], *not* $r or $p. (Also see $_GET for variables
              > >>passed by the GET method). Fix your script. Do not turn
              > >>on "register_globa ls".
              > >>
              > >>Gordon L. Burditt
              > >>
              > >>
              > >>
              > >>>On first loading this page, you would have
              > >>>
              > >>>$p =
              > >>>
              > >>>and the button image below it.
              > >>>On clicking the button the same page would reload but pass the hidden[/color]
              > >
              > > values
              > >[color=darkred]
              > >>>(r=w & p=f)
              > >>>so that the first line of the page would then have
              > >>>
              > >>>$p = f
              > >>>
              > >>>This no longer works???
              > >>>
              > >>><?php
              > >>>echo "<html><bod y>";
              > >>>echo "\$p = $p<br><br>"; //###
              > >>>$str = <<<HTM
              > >>><head>
              > >>></head>
              > >>><body>
              > >>><form action="" method="post">
              > >>> <input type="hidden" name="r" value="w">
              > >>> <input type="hidden" name="p" value="f">
              > >>> <input type="image" src="http://home/images/faq-up.gif" border="0"
              > >>>height="22 " width="77">
              > >>></form>
              > >>></body>
              > >>></html>
              > >>>HTM;
              > >>>echo $str;
              > >>>?>
              > >>>
              > >>>
              > >>>on printing the $_ENV variables along with the the above script I find[/color]
              > >
              > > the
              > >[color=darkred]
              > >>>following :
              > >>>
              > >>>QUERY_METH OD POST
              > >>>REQUEST_METH OD POST
              > >>>FORM_P f
              > >>>FORM_R w
              > >>>
              > >>>Is there something I haven't enabled in my
              > >>>setup of PHP that is stopping this from working now?
              > >>>
              > >>>Or has something changed with PHP, so that I have to do this another[/color][/color][/color]
              way?[color=blue][color=green][color=darkred]
              > >>>
              > >>>many thanks
              > >>>
              > >>>mori
              > >>>
              > >>>
              > >>>
              > >>
              > >>[/color]
              > >
              > >[/color]
              >
              > Try:
              >
              > echo "\$p = " . $HTTP_POST_VARS['p'] . "<br><br>";[/color]

              nope, doesn't work either :(


              Comment

              • Wolfgang Forstmeier

                #8
                Re: problems with POST



                moriman wrote:[color=blue]
                > "Juliette" <jrf_no_spam@jo keaday.net> wrote in message
                > news:438a9e1c$0 $64688$dbd45001 @news.wanadoo.n l...[color=green]
                >> moriman wrote:[color=darkred]
                >>> wow, thx for the *very* quick reply ;-)
                >>>
                >>> tried changing the
                >>> echo "\$p = $p<br><br>";
                >>>
                >>> to
                >>>
                >>> echo "\$p = " . $_POST['p'] . "<br><br>";
                >>>
                >>> but still not working :(
                >>>
                >>> mori
                >>>
                >>> "Gordon Burditt" <gordonb.ari4j@ burditt.org> wrote in message
                >>> news:11ok7r8qgj mg89a@corp.supe rnews.com...
                >>>
                >>>>> The script below *used* to work. I have only just set up a
                >>>>> server, PHP etc again on my Win98 system and now it doesn't?
                >>>> A variable passed from HTML by the POST method is $_POST['r'] or
                >>>> $_POST['p'], *not* $r or $p. (Also see $_GET for variables
                >>>> passed by the GET method). Fix your script. Do not turn
                >>>> on "register_globa ls".
                >>>>
                >>>> Gordon L. Burditt
                >>>>
                >>>>
                >>>>
                >>>>> On first loading this page, you would have
                >>>>>
                >>>>> $p =
                >>>>>
                >>>>> and the button image below it.
                >>>>> On clicking the button the same page would reload but pass the hidden
                >>> values
                >>>
                >>>>> (r=w & p=f)
                >>>>> so that the first line of the page would then have
                >>>>>
                >>>>> $p = f
                >>>>>
                >>>>> This no longer works???
                >>>>>
                >>>>> <?php
                >>>>> echo "<html><bod y>";
                >>>>> echo "\$p = $p<br><br>"; //###
                >>>>> $str = <<<HTM
                >>>>> <head>
                >>>>> </head>
                >>>>> <body>
                >>>>> <form action="" method="post">
                >>>>> <input type="hidden" name="r" value="w">
                >>>>> <input type="hidden" name="p" value="f">
                >>>>> <input type="image" src="http://home/images/faq-up.gif" border="0"
                >>>>> height="22" width="77">
                >>>>> </form>
                >>>>> </body>
                >>>>> </html>
                >>>>> HTM;
                >>>>> echo $str;
                >>>>> ?>
                >>>>>
                >>>>>
                >>>>> on printing the $_ENV variables along with the the above script I find
                >>> the
                >>>
                >>>>> following :
                >>>>>
                >>>>> QUERY_METHOD POST
                >>>>> REQUEST_METHOD POST
                >>>>> FORM_P f
                >>>>> FORM_R w
                >>>>>
                >>>>> Is there something I haven't enabled in my
                >>>>> setup of PHP that is stopping this from working now?
                >>>>>
                >>>>> Or has something changed with PHP, so that I have to do this another[/color][/color]
                > way?[color=green][color=darkred]
                >>>>> many thanks
                >>>>>
                >>>>> mori
                >>>>>
                >>>>>
                >>>>>
                >>>>
                >>>[/color]
                >> Try:
                >>
                >> echo "\$p = " . $HTTP_POST_VARS['p'] . "<br><br>";[/color]
                >
                > nope, doesn't work either :(
                >
                >[/color]

                This will work, you have to set up an submit button
                (javascript or nativ html to send your form data)

                If you would like to have an image you should prefer JavaScript.
                If a simple HTML - Button is enougth try the simple Submit Button like
                in my example.
                Have Fun...

                <?php
                echo "<html>";
                echo "\$p = ".$_POST['p']."<br><br>"; //###
                $str = <<<HTM
                <head>
                </head>
                <body>
                <form action="" method="post">
                <input type="hidden" name="r" value="w">
                <input type="hidden" name="p" value="f">
                <input type="submit">
                </form>
                </body>
                </html>
                HTM;
                echo $str;
                ?>

                Comment

                • Jerry Stuckle

                  #9
                  Re: problems with POST

                  moriman wrote:[color=blue]
                  > Hi,
                  >
                  > The script below *used* to work. I have only just set up a
                  > server, PHP etc again on my Win98 system and now it doesn't?
                  >
                  > On first loading this page, you would have
                  >
                  > $p =
                  >
                  > and the button image below it.
                  > On clicking the button the same page would reload but pass the hidden values
                  > (r=w & p=f)
                  > so that the first line of the page would then have
                  >
                  > $p = f
                  >
                  > This no longer works???
                  >
                  > <?php
                  > echo "<html><bod y>";
                  > echo "\$p = $p<br><br>"; //###
                  > $str = <<<HTM
                  > <head>
                  > </head>
                  > <body>
                  > <form action="" method="post">
                  > <input type="hidden" name="r" value="w">
                  > <input type="hidden" name="p" value="f">
                  > <input type="image" src="http://home/images/faq-up.gif" border="0"
                  > height="22" width="77">
                  > </form>
                  > </body>
                  > </html>
                  > HTM;
                  > echo $str;
                  > ?>
                  >
                  >
                  > on printing the $_ENV variables along with the the above script I find the
                  > following :
                  >
                  > QUERY_METHOD POST
                  > REQUEST_METHOD POST
                  > FORM_P f
                  > FORM_R w
                  >
                  > Is there something I haven't enabled in my
                  > setup of PHP that is stopping this from working now?
                  >
                  > Or has something changed with PHP, so that I have to do this another way?
                  >
                  > many thanks
                  >
                  > mori
                  >
                  >
                  >[/color]
                  How are you submitting your form? I don't see a submit button, for
                  instance.

                  --
                  =============== ===
                  Remove the "x" from my email address
                  Jerry Stuckle
                  JDS Computer Training Corp.
                  jstucklex@attgl obal.net
                  =============== ===

                  Comment

                  • vdP

                    #10
                    Re: problems with POST

                    Jerry Stuckle wrote:[color=blue]
                    > moriman wrote:
                    >[color=green]
                    >> <form action="" method="post">
                    >> <input type="hidden" name="r" value="w">
                    >> <input type="hidden" name="p" value="f">
                    >> <input type="image" src="http://home/images/faq-up.gif" border="0"
                    >> height="22" width="77">
                    >> </form>
                    >>[/color]
                    > How are you submitting your form? I don't see a submit button, for
                    > instance.
                    >[/color]
                    I thought the same till I looked up the HTML-specification at

                    Apparently the input of image type serves as a submit button.

                    vdP

                    Comment

                    • Hilarion

                      #11
                      Re: problems with POST

                      > <?php[color=blue]
                      > echo "<html><bod y>";
                      > echo "\$p = $p<br><br>"; //###[/color]

                      Use $_POST or $HTTP_POST_VARS as others have suggested ($_POST
                      is preferred, $HTTP_POST_VARS only if $_POST does not work, which
                      means that you have OLD version of PHP).
                      [color=blue]
                      > $str = <<<HTM
                      > <head>
                      > </head>
                      > <body>
                      > <form action="" method="post">[/color]

                      Give some value to the "action" attribute. Using empty "action"
                      works differently in different browser. Your browser probably
                      does not send the data in this case.
                      [color=blue]
                      > <input type="hidden" name="r" value="w">
                      > <input type="hidden" name="p" value="f">
                      > <input type="image" src="http://home/images/faq-up.gif" border="0"
                      > height="22" width="77">
                      > </form>
                      > </body>
                      > </html>
                      > HTM;
                      > echo $str;[/color]

                      Why are you building HTML this way just to echo it?
                      [color=blue]
                      > ?>
                      >
                      >
                      > on printing the $_ENV variables along with the the above script I find the
                      > following :
                      >
                      > QUERY_METHOD POST
                      > REQUEST_METHOD POST
                      > FORM_P f
                      > FORM_R w
                      >
                      > Is there something I haven't enabled in my
                      > setup of PHP that is stopping this from working now?
                      >
                      > Or has something changed with PHP, so that I have to do this another way?[/color]

                      Try this:

                      <html>
                      <head>
                      </head>
                      <body>
                      <pre>
                      $_POST <?php print_r( $_POST ); ?>
                      $HTTP_POST_VARS <?php print_r( $HTTP_POST_VARS ); ?>
                      </pre>
                      <form action="<?php echo htmlspecialchar s( $_SERVER['PHP_SELF'] ); ?>" method="post">
                      <input type="hidden" name="r" value="w" />
                      <input type="hidden" name="p" value="f" />
                      <input type="image" src="http://home/images/faq-up.gif" border="0"
                      height="22" width="77" />
                      </form>
                      </body>
                      </html>


                      And check HTML source which gets generated before and after submiting
                      the form. If it still does not work (does not output the posted values),
                      then send what you got to this thread.


                      Hilarion

                      Comment

                      • moriman

                        #12
                        Re: problems with POST

                        "Wolfgang Forstmeier" <wolfgang.forst meier@gmx.de> wrote in message
                        news:dmejl5$ps3 $1@news.mch.sbs .de...[color=blue]
                        >
                        >
                        > moriman wrote:[color=green]
                        > > "Juliette" <jrf_no_spam@jo keaday.net> wrote in message
                        > > news:438a9e1c$0 $64688$dbd45001 @news.wanadoo.n l...[color=darkred]
                        > >> moriman wrote:
                        > >>> wow, thx for the *very* quick reply ;-)
                        > >>>
                        > >>> tried changing the
                        > >>> echo "\$p = $p<br><br>";
                        > >>>
                        > >>> to
                        > >>>
                        > >>> echo "\$p = " . $_POST['p'] . "<br><br>";
                        > >>>
                        > >>> but still not working :(
                        > >>>
                        > >>> mori
                        > >>>
                        > >>> "Gordon Burditt" <gordonb.ari4j@ burditt.org> wrote in message
                        > >>> news:11ok7r8qgj mg89a@corp.supe rnews.com...
                        > >>>
                        > >>>>> The script below *used* to work. I have only just set up a
                        > >>>>> server, PHP etc again on my Win98 system and now it doesn't?
                        > >>>> A variable passed from HTML by the POST method is $_POST['r'] or
                        > >>>> $_POST['p'], *not* $r or $p. (Also see $_GET for variables
                        > >>>> passed by the GET method). Fix your script. Do not turn
                        > >>>> on "register_globa ls".
                        > >>>>
                        > >>>> Gordon L. Burditt
                        > >>>>
                        > >>>>
                        > >>>>
                        > >>>>> On first loading this page, you would have
                        > >>>>>
                        > >>>>> $p =
                        > >>>>>
                        > >>>>> and the button image below it.
                        > >>>>> On clicking the button the same page would reload but pass the[/color][/color][/color]
                        hidden[color=blue][color=green][color=darkred]
                        > >>> values
                        > >>>
                        > >>>>> (r=w & p=f)
                        > >>>>> so that the first line of the page would then have
                        > >>>>>
                        > >>>>> $p = f
                        > >>>>>
                        > >>>>> This no longer works???
                        > >>>>>
                        > >>>>> <?php
                        > >>>>> echo "<html><bod y>";
                        > >>>>> echo "\$p = $p<br><br>"; //###
                        > >>>>> $str = <<<HTM
                        > >>>>> <head>
                        > >>>>> </head>
                        > >>>>> <body>
                        > >>>>> <form action="" method="post">
                        > >>>>> <input type="hidden" name="r" value="w">
                        > >>>>> <input type="hidden" name="p" value="f">
                        > >>>>> <input type="image" src="http://home/images/faq-up.gif" border="0"
                        > >>>>> height="22" width="77">
                        > >>>>> </form>
                        > >>>>> </body>
                        > >>>>> </html>
                        > >>>>> HTM;
                        > >>>>> echo $str;
                        > >>>>> ?>
                        > >>>>>
                        > >>>>>
                        > >>>>> on printing the $_ENV variables along with the the above script I[/color][/color][/color]
                        find[color=blue][color=green][color=darkred]
                        > >>> the
                        > >>>
                        > >>>>> following :
                        > >>>>>
                        > >>>>> QUERY_METHOD POST
                        > >>>>> REQUEST_METHOD POST
                        > >>>>> FORM_P f
                        > >>>>> FORM_R w
                        > >>>>>
                        > >>>>> Is there something I haven't enabled in my
                        > >>>>> setup of PHP that is stopping this from working now?
                        > >>>>>
                        > >>>>> Or has something changed with PHP, so that I have to do this another[/color]
                        > > way?[color=darkred]
                        > >>>>> many thanks
                        > >>>>>
                        > >>>>> mori
                        > >>>>>
                        > >>>>>
                        > >>>>>
                        > >>>>
                        > >>>
                        > >> Try:
                        > >>
                        > >> echo "\$p = " . $HTTP_POST_VARS['p'] . "<br><br>";[/color]
                        > >
                        > > nope, doesn't work either :(
                        > >
                        > >[/color]
                        >
                        > This will work, you have to set up an submit button
                        > (javascript or nativ html to send your form data)
                        >
                        > If you would like to have an image you should prefer JavaScript.
                        > If a simple HTML - Button is enougth try the simple Submit Button like
                        > in my example.
                        > Have Fun...
                        >
                        > <?php
                        > echo "<html>";
                        > echo "\$p = ".$_POST['p']."<br><br>"; //###
                        > $str = <<<HTM
                        > <head>
                        > </head>
                        > <body>
                        > <form action="" method="post">
                        > <input type="hidden" name="r" value="w">
                        > <input type="hidden" name="p" value="f">
                        > <input type="submit">
                        > </form>
                        > </body>
                        > </html>
                        > HTM;
                        > echo $str;
                        > ?>[/color]

                        Did you try this wolfgang? I did and it doesn't work for me¿


                        Comment

                        • moriman

                          #13
                          Re: problems with POST

                          "vdP" <hvdploeg_NO_SP AM@wanadoo.nl> wrote in message
                          news:438b21cb$0 $81486$dbd45001 @news.wanadoo.n l...[color=blue]
                          > Jerry Stuckle wrote:[color=green]
                          > > moriman wrote:
                          > >[color=darkred]
                          > >> <form action="" method="post">
                          > >> <input type="hidden" name="r" value="w">
                          > >> <input type="hidden" name="p" value="f">
                          > >> <input type="image" src="http://home/images/faq-up.gif" border="0"
                          > >> height="22" width="77">
                          > >> </form>
                          > >>[/color]
                          > > How are you submitting your form? I don't see a submit button, for
                          > > instance.
                          > >[/color]
                          > I thought the same till I looked up the HTML-specification at
                          > http://www.w3.org/TR/REC-html40/inte...ms.html#h-17.4
                          > Apparently the input of image type serves as a submit button.
                          >
                          > vdP[/color]

                          Yes, that's correct, the image acts as the submit button ;-)


                          Comment

                          • moriman

                            #14
                            Re: problems with POST


                            "Hilarion" <hilarion@SPAM. op.SMIECI.pl> wrote in message
                            news:dmfjob$v07 $1@news.onet.pl ...[color=blue][color=green]
                            > > <?php
                            > > echo "<html><bod y>";
                            > > echo "\$p = $p<br><br>"; //###[/color]
                            >
                            > Use $_POST or $HTTP_POST_VARS as others have suggested ($_POST
                            > is preferred, $HTTP_POST_VARS only if $_POST does not work, which
                            > means that you have OLD version of PHP).
                            >[color=green]
                            > > $str = <<<HTM
                            > > <head>
                            > > </head>
                            > > <body>
                            > > <form action="" method="post">[/color]
                            >
                            > Give some value to the "action" attribute. Using empty "action"
                            > works differently in different browser. Your browser probably
                            > does not send the data in this case.
                            >[/color]

                            action="" posts the data to the file\page that is loaded.
                            As you will also see from the OP, the data *is* being sent
                            [color=blue][color=green]
                            > > on printing the $_ENV variables along with the the above script I find[/color][/color]
                            the[color=blue][color=green]
                            > > following :
                            > >
                            > > QUERY_METHOD POST
                            > > REQUEST_METHOD POST
                            > > FORM_P f
                            > > FORM_R w[/color][/color]

                            the FORM_P f and FORM_R w are the data that have been received. Only I can't
                            seem to 'get hold' of them.
                            [color=blue][color=green]
                            > > <input type="hidden" name="r" value="w">
                            > > <input type="hidden" name="p" value="f">
                            > > <input type="image" src="http://home/images/faq-up.gif" border="0"
                            > > height="22" width="77">
                            > > </form>
                            > > </body>
                            > > </html>
                            > > HTM;
                            > > echo $str;[/color]
                            >
                            > Why are you building HTML this way just to echo it?
                            >[color=green]
                            > > ?>
                            > >
                            > >
                            > > on printing the $_ENV variables along with the the above script I find[/color][/color]
                            the[color=blue][color=green]
                            > > following :
                            > >
                            > > QUERY_METHOD POST
                            > > REQUEST_METHOD POST
                            > > FORM_P f
                            > > FORM_R w
                            > >
                            > > Is there something I haven't enabled in my
                            > > setup of PHP that is stopping this from working now?
                            > >
                            > > Or has something changed with PHP, so that I have to do this another[/color][/color]
                            way?[color=blue]
                            >
                            > Try this:
                            >
                            > <html>
                            > <head>
                            > </head>
                            > <body>
                            > <pre>
                            > $_POST <?php print_r( $_POST ); ?>
                            > $HTTP_POST_VARS <?php print_r( $HTTP_POST_VARS ); ?>
                            > </pre>
                            > <form action="<?php echo htmlspecialchar s( $_SERVER['PHP_SELF'] ); ?>"[/color]
                            method="post">[color=blue]
                            > <input type="hidden" name="r" value="w" />
                            > <input type="hidden" name="p" value="f" />
                            > <input type="image" src="http://home/images/faq-up.gif" border="0"
                            > height="22" width="77" />
                            > </form>
                            > </body>
                            > </html>
                            >
                            >
                            > And check HTML source which gets generated before and after submiting
                            > the form. If it still does not work (does not output the posted values),
                            > then send what you got to this thread.
                            >
                            >[/color]
                            There is some problem with your above action as it sends the post to


                            not


                            the absolute path to the script is C:/XITAMI-25/APP/public_html/test.php
                            where C:/XITAMI-25/APP/public_html/ is analogous to my server's http://home

                            I have also added the following to my script

                            foreach ($_POST as $key => $value) {echo "{$key}={$value }<br>";}

                            and this doesn't print anything. Very strange. How can I get

                            FORM_P f
                            FORM_R w

                            yet $_POST appears to be empty¿

                            The further I go, the less I know

                            [color=blue]
                            > Hilarion[/color]



                            Comment

                            • Wolfgang Forstmeier

                              #15
                              Re: problems with POST



                              moriman wrote:[color=blue]
                              > "Wolfgang Forstmeier" <wolfgang.forst meier@gmx.de> wrote in message
                              > news:dmejl5$ps3 $1@news.mch.sbs .de...
                              >[color=green]
                              >>
                              >>moriman wrote:
                              >>[color=darkred]
                              >>>"Juliette" <jrf_no_spam@jo keaday.net> wrote in message
                              >>>news:438a9e1 c$0$64688$dbd45 001@news.wanado o.nl...
                              >>>
                              >>>>moriman wrote:
                              >>>>
                              >>>>>wow, thx for the *very* quick reply ;-)
                              >>>>>
                              >>>>>tried changing the
                              >>>>>echo "\$p = $p<br><br>";
                              >>>>>
                              >>>>>to
                              >>>>>
                              >>>>>echo "\$p = " . $_POST['p'] . "<br><br>";
                              >>>>>
                              >>>>>but still not working :(
                              >>>>>
                              >>>>>mori
                              >>>>>
                              >>>>>"Gordon Burditt" <gordonb.ari4j@ burditt.org> wrote in message
                              >>>>>news:11ok7 r8qgjmg89a@corp .supernews.com. ..
                              >>>>>
                              >>>>>
                              >>>>>>>The script below *used* to work. I have only just set up a
                              >>>>>>>server , PHP etc again on my Win98 system and now it doesn't?
                              >>>>>>
                              >>>>>>A variable passed from HTML by the POST method is $_POST['r'] or
                              >>>>>>$_POST['p'], *not* $r or $p. (Also see $_GET for variables
                              >>>>>>passed by the GET method). Fix your script. Do not turn
                              >>>>>>on "register_globa ls".
                              >>>>>>
                              >>>>>>Gordon L. Burditt
                              >>>>>>
                              >>>>>>
                              >>>>>>
                              >>>>>>
                              >>>>>>>On first loading this page, you would have
                              >>>>>>>
                              >>>>>>>$p =
                              >>>>>>>
                              >>>>>>>and the button image below it.
                              >>>>>>>On clicking the button the same page would reload but pass the[/color][/color]
                              >
                              > hidden
                              >[color=green][color=darkred]
                              >>>>>values
                              >>>>>
                              >>>>>
                              >>>>>>>(r=w & p=f)
                              >>>>>>>so that the first line of the page would then have
                              >>>>>>>
                              >>>>>>>$p = f
                              >>>>>>>
                              >>>>>>>This no longer works???
                              >>>>>>>
                              >>>>>>><?php
                              >>>>>>>echo "<html><bod y>";
                              >>>>>>>echo "\$p = $p<br><br>"; //###
                              >>>>>>>$str = <<<HTM
                              >>>>>>><head>
                              >>>>>>></head>
                              >>>>>>><body>
                              >>>>>>><form action="" method="post">
                              >>>>>>><input type="hidden" name="r" value="w">
                              >>>>>>><input type="hidden" name="p" value="f">
                              >>>>>>><input type="image" src="http://home/images/faq-up.gif" border="0"
                              >>>>>>>height=" 22" width="77">
                              >>>>>>></form>
                              >>>>>>></body>
                              >>>>>>></html>
                              >>>>>>>HTM;
                              >>>>>>>echo $str;
                              >>>>>>>?>
                              >>>>>>>
                              >>>>>>>
                              >>>>>>>on printing the $_ENV variables along with the the above script I[/color][/color]
                              >
                              > find
                              >[color=green][color=darkred]
                              >>>>>the
                              >>>>>
                              >>>>>
                              >>>>>>>followin g :
                              >>>>>>>
                              >>>>>>>QUERY_ME THOD POST
                              >>>>>>>REQUEST_ METHOD POST
                              >>>>>>>FORM_P f
                              >>>>>>>FORM_R w
                              >>>>>>>
                              >>>>>>>Is there something I haven't enabled in my
                              >>>>>>>setup of PHP that is stopping this from working now?
                              >>>>>>>
                              >>>>>>>Or has something changed with PHP, so that I have to do this another
                              >>>
                              >>>way?
                              >>>
                              >>>>>>>many thanks
                              >>>>>>>
                              >>>>>>>mori
                              >>>>>>>
                              >>>>>>>
                              >>>>>>>
                              >>>>>>
                              >>>>Try:
                              >>>>
                              >>>>echo "\$p = " . $HTTP_POST_VARS['p'] . "<br><br>";
                              >>>
                              >>>nope, doesn't work either :(
                              >>>
                              >>>[/color]
                              >>
                              >>This will work, you have to set up an submit button
                              >>(javascript or nativ html to send your form data)
                              >>
                              >>If you would like to have an image you should prefer JavaScript.
                              >>If a simple HTML - Button is enougth try the simple Submit Button like
                              >>in my example.
                              >>Have Fun...
                              >>
                              >><?php
                              >>echo "<html>";
                              >>echo "\$p = ".$_POST['p']."<br><br>"; //###
                              >>$str = <<<HTM
                              >><head>
                              >></head>
                              >><body>
                              >><form action="" method="post">
                              >> <input type="hidden" name="r" value="w">
                              >> <input type="hidden" name="p" value="f">
                              >> <input type="submit">
                              >></form>
                              >></body>
                              >></html>
                              >>HTM;
                              >>echo $str;
                              >>?>[/color]
                              >
                              >
                              > Did you try this wolfgang? I did and it doesn't work for me�
                              >
                              >[/color]
                              for me this has worked perfekt ..

                              Comment

                              Working...