Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] error in "JavaScript: The Definitive Guide"?


  • From: dnunes at gmail.com (diego nunes)
  • Subject: [Javascript] error in "JavaScript: The Definitive Guide"?
  • Date: Wed Nov 29 08:15:18 2006

On 11/29/06, John Deighan <jdeighan@xxxxxxxxx> wrote:
> For input elements of type "radio" and "checkbox", it is common to
> define more than one related object, each of which have the same
> 'name' property. In this case, data is submitted to the server with
> this format:
>
>         name=value1,value2,...,valuen

    As far as I know, in ASP you have the "bla=1,2,3,4" format, but it
doesn't happen with all languages. I just don't get the point of why
this happens, 'cause, in theory, it's the browser that handle this,
but, anyway, try this:
<form action="teste.asp">
  <input type="text" name="teste" value="mimimi" />
  <input type="text" name="teste" value="blabla" />
</form>

    When in ASP, it appear as "teste=mimimi,blabla", but in PHP it
will be "teste=mimimi&teste=blabla", which gives you only one value
when getting the querystring ($_GET['teste'] returns only "blabla").
In PHP I always use name="DESIRED_NAME[]" (note the "[]" at the end),
which gives you an Array with the values, in the server side language
-- obviously it doens't work with ASP at all.

--
diego nunes
dnunes.com