why doesn't this work?

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

    why doesn't this work?

    All I'm trying to do is pass a value to a page from a link. First, here
    is the page with the link.


    <HTML>
    <HEAD></HEAD>
    <BODY>
    <FORM action=receiveP ost.php method=POST>
    <a href="receivePo st.php?abc=snaz zi&def=flattene d">click for amazing
    results and happiness at least through the weekend.</a>
    <BR><BR><inpu t type=text name=def>
    <BR><BR><inpu t type=submit value='push me'>
    </FORM>
    </BODY>
    </HTML>

    If you want to copy the above page, name it sendPost.htm

    Next, the page that receives and *SHOULD* display the results. Either
    it's not receiving or it's not displaying. Either way, I cannot get a
    value for abc. The text box is there just to see if I could pass data
    the way that I have experience with.

    <?php
    echo "<HTML>";
    echo "<HEAD></HEAD>";
    echo "<BODY>";
    echo "abc is $_POST[abc]";
    echo "<BR>def is $_POST[def]";
    echo "<BR><BR><a href='sendPost. htm'>go back</a>";
    echo "</BODY>";
    echo "</HTML>";
    ?>

    this file should be named receivePost.php

    Thank you in advance, o learned and generous and patient lot that thou art.
    Jeff Sandler
  • Lee

    #2
    Re: why doesn't this work?

    Jeff Sandler said:[color=blue]
    >
    >All I'm trying to do is pass a value to a page from a link. First, here
    >is the page with the link.
    >
    >
    ><HTML>
    ><HEAD></HEAD>
    ><BODY>
    ><FORM action=receiveP ost.php method=POST>
    ><a href="receivePo st.php?abc=snaz zi&def=flattene d">click for amazing
    >results and happiness at least through the weekend.</a>
    ><BR><BR><inp ut type=text name=def>
    ><BR><BR><inp ut type=submit value='push me'>
    ></FORM>
    ></BODY>
    ></HTML>
    >
    >If you want to copy the above page, name it sendPost.htm
    >
    >Next, the page that receives and *SHOULD* display the results. Either
    >it's not receiving or it's not displaying. Either way, I cannot get a
    >value for abc. The text box is there just to see if I could pass data
    >the way that I have experience with.
    >
    ><?php
    >echo "<HTML>";
    >echo "<HEAD></HEAD>";
    >echo "<BODY>";
    >echo "abc is $_POST[abc]";
    >echo "<BR>def is $_POST[def]";
    >echo "<BR><BR><a href='sendPost. htm'>go back</a>";
    >echo "</BODY>";
    >echo "</HTML>";
    >?>
    >
    >this file should be named receivePost.php
    >
    >Thank you in advance, o learned and generous and patient lot that thou art.[/color]

    You'll find that we're actually more patient with questions that have anything
    at all to do with Javascript. You seem to have a PHP question.

    Comment

    • Joakim Braun

      #3
      Re: why doesn't this work?

      "Jeff Sandler" <ffej2ffej@dsle xtreme.com> skrev i meddelandet
      news:10skq3vduf ir3ae@corp.supe rnews.com...[color=blue]
      > All I'm trying to do is pass a value to a page from a link. First, here
      > is the page with the link.[/color]
      <snip>[color=blue]
      >
      > Next, the page that receives and *SHOULD* display the results. Either[/color]
      <snip>[color=blue]
      > <?php
      > echo "<HTML>";
      > echo "<HEAD></HEAD>";
      > echo "<BODY>";
      > echo "abc is $_POST[abc]";[/color]

      echo 'abc is ' . $_POST['abc'];

      Assuming that you get to the PHP page all right, you then need to 1) use the
      concatenation operator ".", 2) quote the array index into $_POST. (At least,
      the way I'm used to PHP)

      Joakim Braun


      Comment

      • Jeff Sandler

        #4
        Re: why doesn't this work?

        Thank you for your suggestions. The bad news is I tried them and it
        still doesn't work. I await your reply.




        *** Sent via Developersdex http://www.developersdex.com ***
        Don't just participate in USENET...get rewarded for it!

        Comment

        • Hywel Jenkins

          #5
          Re: why doesn't this work?

          In article <10skq3vdufir3a e@corp.supernew s.com>,
          ffej2ffej@dslex treme.com says...[color=blue]
          > All I'm trying to do is pass a value to a page from a link. First, here
          > is the page with the link.[/color]

          <snip>

          Where's the JavaScript?

          --
          Hywel http://kibo.org.uk/
          I do not eat quiche.

          Comment

          • Grant Wagner

            #6
            Re: why doesn't this work?

            "Jeff Sandler" <ffej2ffej@dsle xtreme.com> wrote in message
            news:10skq3vduf ir3ae@corp.supe rnews.com...[color=blue]
            > All I'm trying to do is pass a value to a page from a link. First,[/color]
            here[color=blue]
            > is the page with the link.
            >
            >
            > <HTML>
            > <HEAD></HEAD>
            > <BODY>
            > <FORM action=receiveP ost.php method=POST>
            > <a href="receivePo st.php?abc=snaz zi&def=flattene d">click for amazing
            > results and happiness at least through the weekend.</a>
            > <BR><BR><inpu t type=text name=def>
            > <BR><BR><inpu t type=submit value='push me'>
            > </FORM>
            > </BODY>
            > </HTML>
            >
            > If you want to copy the above page, name it sendPost.htm
            >
            > Next, the page that receives and *SHOULD* display the results. Either
            > it's not receiving or it's not displaying. Either way, I cannot get a
            > value for abc. The text box is there just to see if I could pass data
            > the way that I have experience with.[/color]

            -abc- is not going to be passed to -receivePost.php- if the -submit-
            button is being clicked (it is not part of the form).

            -abc- will be passed to -receivePost.php- if you click the hypertext
            link, but it won't be part of a POST, it will be the result of a GET.

            To retrieve the value of -abc- in <a
            href="receivePo st.php?abc=snaz zi&def=flattene d"> you need to retrieve

            $_GET['abc']

            not

            $_POST['abc']

            --
            Grant Wagner <gwagner@agrico reunited.com>
            comp.lang.javas cript FAQ - http://jibbering.com/faq


            Comment

            • Michael Winter

              #7
              Re: why doesn't this work?

              On 23 Dec 2004 10:55:35 -0600, Jeff Sandler <ffej2ffej@dsle xtreme.com>
              wrote:
              [color=blue]
              > Thank you for your suggestions. The bad news is I tried them and it
              > still doesn't work. I await your reply.[/color]

              As Lee implied, you'd find more help at a PHP group like comp.lang.php.

              However, I can tell you that you should be using $_GET not $_POST, and you
              should be able to improve performance by only writing the dynamic parts:

              <?php
              if(count($_GET) ) {
              echo "\t<dl>\n";
              foreach ($_GET as $key => $value) {
              echo "\t<dt>$key </dt><dd>$value</dd>\n";
              }
              echo "\t</dl>\n";
              } else {
              echo "<p>No name/value pairs were sent to this page.</p>\n";
              }
              ?>

              A full example (in plain text) can be found at
              <URL:http://www.mlwinter.pw p.blueyonder.co .uk/clj/sandler/get.php.txt>.

              Good luck,
              Mike

              --
              Michael Winter
              Replace ".invalid" with ".uk" to reply by e-mail.

              Comment

              Working...