Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 08:21 PM
Sugapablo
Guest
 
Posts: n/a
Default 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&task=addcart&item=1&y0=6&y2=8&cnt=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@12jabber.com <--jabber IM ]

  #2  
Old July 20th, 2005, 08:21 PM
Chris Morris
Guest
 
Posts: n/a
Default Re: Odd occurence with extra variables in GET form

Sugapablo <russ@REMOVEsugapablo.com> writes:[color=blue]
> <input type="image" src="cart.png" value="Submit">
>
> checkboxes, I get the following querystring:
>
> ?name=Catalog&task=addcart&item=1&y0=6&y2=8&cnt=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
  #3  
Old July 20th, 2005, 08:21 PM
Brian
Guest
 
Posts: n/a
Default 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>Available 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&task=addcart&item=1&y0=6&y2=8&cnt=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:

http://www.w3.org/TR/html4/

Particularly, the section on forms:

http://www.w3.org/TR/html4/interact/forms.html

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
  #4  
Old July 20th, 2005, 08:21 PM
Brian
Guest
 
Posts: n/a
Default Re: Odd occurence with extra variables in GET form

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

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

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

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles