form not sending parameters?

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

    form not sending parameters?

    I'm new to PHP...and my previous post was a bit premature. I've narrowed my
    problem down to this:

    I have this very simple form in test1.php

    <form name='formx6' action="testz.p hp?varxy=1">
    <input type="text">
    <input type="submit" value="sub">
    </form>

    Why is it that the querystring on testz.php looks like:


    I know it's probably something easy...thanks in advance.

    -bruce duncan


  • Bruce Duncan

    #2
    Re: form not sending parameters?

    "Bruce Duncan" <bruce~w~duncan @~hotmail.com> wrote in message
    news:10bf35i59n rusf5@corp.supe rnews.com...[color=blue]
    > I'm new to PHP...and my previous post was a bit premature. I've narrowed[/color]
    my[color=blue]
    > problem down to this:
    >
    > I have this very simple form in test1.php
    >
    > <form name='formx6' action="testz.p hp?varxy=1">
    > <input type="text">
    > <input type="submit" value="sub">
    > </form>
    >
    > Why is it that the querystring on testz.php looks like:
    > http://localhost/php/testz.php?
    >
    > I know it's probably something easy...thanks in advance.
    >
    > -bruce duncan
    >[/color]


    Got it...needed the form's method='post'
    -bruce duncan



    Comment

    • Michael J. Astrauskas

      #3
      Re: form not sending parameters?

      Bruce Duncan wrote:
      [color=blue]
      > Bruce Duncan wrote:
      >[color=green]
      >> I'm new to PHP...and my previous post was a bit premature. I've narrowed
      >> my problem down to this:
      >>
      >> I have this very simple form in test1.php
      >>
      >> <form name='formx6' action="testz.p hp?varxy=1">
      >> <input type="text">
      >> <input type="submit" value="sub">
      >> </form>
      >>
      >> Why is it that the querystring on testz.php looks like:
      >> http://localhost/php/testz.php?
      >>
      >> I know it's probably something easy...thanks in advance.[/color]
      >
      > Got it...needed the form's method='post'[/color]

      I think you mean "method='ge t'". 'Post' should pass the variables along
      to the next page discreetely while 'get' passes them in the URL.

      --
      - Michael J. Astrauskas

      Comment

      • John Dunlop

        #4
        Re: form not sending parameters?

        Michael J. Astrauskas wrote:
        [color=blue]
        > Bruce Duncan wrote:
        >[color=green]
        > > Bruce Duncan wrote:
        > >[color=darkred]
        > > > <form name='formx6' action="testz.p hp?varxy=1">[/color][/color][/color]

        [ ... ]
        [color=blue][color=green]
        > > Got it...needed the form's method='post'[/color]
        >
        > I think you mean "method='ge t'".[/color]

        I don't think so.

        GET doesn't make much sense when the form's action attribute is an URI
        containing a query component. Yes, it's valid; yes, it conforms to
        the HTML specification. But what happens when the form is submitted?

        This is where things get iffy. According to the HTML specification, a
        question mark is appended to the value of the action attribute and the
        encoded data is appended after that (HTML4.01, sec. 17.13.3). This
        results in a URI with two "?"s, which is syntactically OK [1], for the
        second question mark is simply query component data.

        Consider how such a URI is interpreted:



        PHP will, correctly, resolve a=1, b=2?c=3 and d=4. Notice how the
        last name=value pair from the action attribute's URI and the first
        name=value pair from the form data set have merged!

        In reality, however, it seems that, when the method is GET, browsers
        remove any query component from the action attribute value before
        making appendages. Every browser I tried behaved this way; every
        browser I tried violated the HTML specification this way.

        But hey, it ain't raining at least. Have a good one. ;o)


        [1] It's OK by RFC2396; moreover, it looks like the next generic URI
        spec will explicitly mention query components containing non-percent-
        encoded question marks. See http://lists.w3.org/Archives/Public/uri/ .

        --
        Jock

        Comment

        • Philipp Kern

          #5
          Re: form not sending parameters?

          On 2004-05-29, John Dunlop <usenet+2004@jo hn.dunlop.name> wrote:[color=blue]
          > GET doesn't make much sense when the form's action attribute is an URI
          > containing a query component. Yes, it's valid; yes, it conforms to
          > the HTML specification. But what happens when the form is submitted?[/color]

          That's what hidden inputs are for.
          <input type="hidden" name="action" value="search" />

          This does pass along the argument you stated in the action URI.

          Bye,
          phil
          --
          Please send replies (not followups) to the address set in Reply-To.
          Philipp Kern - PK2186-RIPE - http://www.philkern.de

          Comment

          Working...