Re: [PHP] Take JS array send by form

2001-08-01 Thread Richard Lynch

>you have to name the fields pn[0],pn[1]...
>(you can name them all pn[] but you might have problems with the
>javascript)

With or without the indices inside [] makes no difference to JavaScript
(viz).

>then to access them from javascript you go something like:
>document.forms[0].elements['pn[0]'];
>
>---> using document.forms[0].pn[0] won't work.

Neither will work.

There is no combination of 'pn', '[]', and/or '0' that will work in
JavaScript to use a human-readable name matching PHP's pn[] system.
Guaranteed, cuz I spent days trying every damn one of 'em, as well as other
things that never had a chance of working.

You'll just have to use:
document.forms[0].elements[5]
document.forms[0].elements[6]
document.forms[0].elements[7]
document.forms[0].elements[8]
.
.
.

Start at whatever number the first 'pn' is, (presumably you know that) and
end when you hit the name after the last 'pn'.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Take JS array send by form

2001-08-01 Thread Mark Maggelet

On Wed, 1 Aug 2001 23:17:49 +0200, Ivo ([EMAIL PROTECTED])
wrote:
>Hi
>
>I faced following problem:
>
>I've a form where which could have one or more input text fields (it
>is not
>clear how many they will be - one or more). Thay have same name - pn
>- and
>if they are more that one JavaScript treat them as an array - pn[x]
>
>The problem is that when I receive this form with more than one
>field - i.e.
>pm[2] - in my php script only the last value is seen, others are
>lost i.e. I
>loose pn[0], pn[1] and receive only pn[2] as a *pn* variable. I mean
>that it
>is NOT an array at all.
>
>What's the problem and how could I solve it? Thank you

you have to name the fields pn[0],pn[1]...
(you can name them all pn[] but you might have problems with the
javascript)

then to access them from javascript you go something like:
document.forms[0].elements['pn[0]'];

---> using document.forms[0].pn[0] won't work.

-- Mark


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]