Odd occurence with extra variables in GET form

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

    Odd occurence with extra variables in GET form

    I have the following HTML form:
    <form method="GET" action="modules .php">
    <input type="hidden" name="name" value="Catalog" >
    <input type="hidden" name="task" value="addcart" >
    <input type="hidden" name="item" value="1">

    <P>Available option: thing b - $44.90
    <input type="checkbox" name="y0" value="6"></P>
    <P>Available option: thingc - $-3.00
    <input type="checkbox" name="y1" value="7"></P>
    <P>Available option: thingd - $2.80
    <input type="checkbox" name="y2" value="8"></P>

    <input type="hidden" name="cnt" value="3">
    <center>
    <input type="image" src="cart.png" value="Submit">
    </center>
    </form>

    When I submit the form, lets say I check off the first and the third
    checkboxes, I get the following querystring:

    ?name=Catalog&t ask=addcart&ite m=1&y0=6&y2=8&c nt=3&x=48&y=4

    Where in the world are x=48 and y=4 coming from?

    They seem to be coming from the position I click on the submit image? Is
    this right? Can someone point me to a page talking about this, I can't
    google anything?


    --
    [ Sugapablo ]
    [ http://www.sugapablo.com <--music ]
    [ http://www.sugapablo.net <--personal ]
    [ sugapablo@12jab ber.com <--jabber IM ]

  • Chris Morris

    #2
    Re: Odd occurence with extra variables in GET form

    Sugapablo <russ@REMOVEsug apablo.com> writes:[color=blue]
    > <input type="image" src="cart.png" value="Submit">
    >
    > checkboxes, I get the following querystring:
    >
    > ?name=Catalog&t ask=addcart&ite m=1&y0=6&y2=8&c nt=3&x=48&y=4
    >
    > Where in the world are x=48 and y=4 coming from?
    >
    > They seem to be coming from the position I click on the submit image? Is
    > this right? Can someone point me to a page talking about this, I can't
    > google anything?[/color]

    That's correct, yes.
    http://www.htmlhelp.com/reference/ht...rms/input.html - about 2/3
    of the way down.

    Incidentally, wouldn't value="Add to Cart" be friendlier than
    value="Submit"?

    --
    Chris

    Comment

    • Brian

      #3
      Re: Odd occurence with extra variables in GET form

      Sugapablo wrote:
      [color=blue]
      > I have the following HTML form:
      > <form method="GET" action="modules .php">[/color]

      Order forms are not normally idempotent. method="POST" is likely more
      appropriate.
      [color=blue]
      > <input type="hidden" name="name" value="Catalog" >
      > <input type="hidden" name="task" value="addcart" >
      > <input type="hidden" name="item" value="1">
      >
      > <P>Available option: thing b - $44.90
      > <input type="checkbox" name="y0" value="6"></P>[/color]

      Since this is not a paragraph, <P> markup is inappropriate. How about
      this?

      <div><label>Ava ilable option</label><input ...></div>
      [color=blue]
      > <input type="image" src="cart.png" value="Submit">
      >
      > When I submit the form, lets say I check off the first and the
      > third checkboxes, I get the following querystring:
      >
      > ?name=Catalog&t ask=addcart&ite m=1&y0=6&y2=8&c nt=3&x=48&y=4
      >
      > Where in the world are x=48 and y=4 coming from?
      >
      > They seem to be coming from the position I click on the submit
      > image?[/color]

      Of course. That's pretty much as the HTML spec requires.
      [color=blue]
      > Is this right? Can someone point me to a page talking about this,
      > I can't google anything?[/color]

      Why? Is Google not responding? I'd start at the w3c's HTML recommedation:



      Particularly, the section on forms:



      --
      Brian (remove ".invalid" to email me)

      Comment

      • Brian

        #4
        Re: Odd occurence with extra variables in GET form

        Brian wrote:
        [color=blue]
        > <div><label>Ava ilable option</label><input ...></div>[/color]

        Typed that way too fast. That would not be very useful. This is better:

        <div>
        <label for="y0">Availa ble option</label>
        <input name="y0" id="y0" type="checkbox" value="6">
        </div>

        --
        Brian (remove ".invalid" to email me)

        Comment

        Working...