Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

forms that look like grids -- are values correlated?

Question posted by: Chris Curvey (Guest) on June 27th, 2008 07:16 PM
I have a form like this, which looks like a grid of entries.

<form method="get" action="/dosomething>
<table>
<tr>
<td><input type="text" name="foo" value="1"></td>
<td><input type="text" name="bar" value="3"></td>
</tr>

<tr>
<td><input type="text" name="foo" value="2"></td>
<td><input type="text" name="bar" value="4"></td>
</tr>
</table>
</form>

now if I submit that form the resulting URL looks like

/dosomething?foo=1&bar=3&foo=2&bar=4

so, my question is: are the values guaranteed to be correlated? that
is, can I assume that the the first entries for foo & bar (1&3) go
"together" and the second entries (2&4) "go together"?

(or perhaps a better questions is, "What are the rules (if any) for
multiple fields with the same name, and do they vary by browser?)
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
Jukka K. Korpela's Avatar
Jukka K. Korpela
Guest
n/a Posts
June 27th, 2008
07:16 PM
#2

Re: forms that look like grids -- are values correlated?
Scripsit Adrienne Boswell:
Quote:
Originally Posted by
What I get on the server is an array containing the values,eg:
foo = a, b, c, d


Perhaps, but that's external to both HTML and HTTP. It is a matter of
the server-side interface between incoming HTTP data and your scripting
environment.

You might have a problem there with some forms and some data, so you may
need to check, from suitable documentation, how the interface handles
a) fields with empty values, such as
foo=
(does it generate an element in the array, just with empty content?)
b) identical fields, e.g.
foo=a
foo=a
(does it generate two elements or just one element the array? The latter
would mean loosing some information, though this might be quite
acceptable and even desirable - it really depends)

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/


 
Not the answer you were looking for? Post your question . . .
183,944 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors