forms that look like grids -- are values correlated?

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

    forms that look like grids -- are values correlated?

    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?)
  • Jukka K. Korpela

    #2
    Re: forms that look like grids -- are values correlated?

    Scripsit Adrienne Boswell:
    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")


    Comment

    Working...