Re: [PHP] Array variable in Javascript & PHP

2002-07-29 Thread Martin Clifford

PHP cannot read a JavaScript array, simple as that.  There are many workarounds, 
depending upon your situation.  You can, for instance, create a function that is 
called onsubmit, that will take any values in checked checkboxes and put them into a 
comma-delimitted string inside a hidden form element.  That string is then passed to 
the PHP page, where it can be parsed (ala implode/explode) and put into a new array.

I hope that made some sense :o)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


>>> "Sheni R. Meledath" <[EMAIL PROTECTED]> 07/29/02 11:18AM >>>
Hello:

In a form I am using a series of check boxes for a number of lists. Some 
calculations has to be done on the client side using Javascript depending 
upon the check box values. For this I am using a single variable name 
(array) for the check boxes in a list and another for the next list and so 
on. The format I have used is
 
Education
 
Profession

I can access these variables from Javascript as list1[0] & list1[1].
(document.form.list1['0'].checked & document.form.list1['1'].checked

But when this form is submitted to the PHP script I am getting only the 
last value. list1 = 'Profession'. I am not getting an array of values.


How can I accomplish both these operations? I cannot use single variables 
names for each item in the form, because it is more than 1000. Also I want 
to use both Javascript & PHP operations. Please help to solve this issue or 
suggest some other ways to accomplish this business logic.

Many Thanks in Advance & Best Regards
Sheni R Meledath
[EMAIL PROTECTED] 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Array variable in Javascript & PHP

2002-07-29 Thread Danny Shepherd

Try using:

 Education
 Profession

That's what I used when doing something pretty similar to you.

HTH

Danny.


- Original Message -
From: "Sheni R. Meledath" <[EMAIL PROTECTED]>
To: "PHP Masters" <[EMAIL PROTECTED]>
Sent: Monday, July 29, 2002 4:11 PM
Subject: [PHP] Array variable in Javascript & PHP


> Hello:
>
> In a form I am using a series of check boxes for a number of lists. Some
> calculations has to be done on the client side using Javascript depending
> upon the check box values. For this I am using a single variable name
> (array) for the check boxes in a list and another for the next list and so
> on. The format I have used is
> 
> Education
> 
> Profession
>
> I can access these variables from Javascript as list1[0] & list1[1].
> (document.form.list1['0'].checked & document.form.list1['1'].checked
>
> But when this form is submitted to the PHP script I am getting only the
> last value. list1 = 'Profession'. I am not getting an array of values.
>  for ($i=0; $i {
> $listall .= '$list1[$i],';
> }
> ?>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Array variable in Javascript & PHP

2002-07-29 Thread Sheni R. Meledath

Hello:

In a form I am using a series of check boxes for a number of lists. Some 
calculations has to be done on the client side using Javascript depending 
upon the check box values. For this I am using a single variable name 
(array) for the check boxes in a list and another for the next list and so 
on. The format I have used is
 
Education
 
Profession

I can access these variables from Javascript as list1[0] & list1[1].
(document.form.list1['0'].checked & document.form.list1['1'].checked

But when this form is submitted to the PHP script I am getting only the 
last value. list1 = 'Profession'. I am not getting an array of values.


How can I accomplish both these operations? I cannot use single variables 
names for each item in the form, because it is more than 1000. Also I want 
to use both Javascript & PHP operations. Please help to solve this issue or 
suggest some other ways to accomplish this business logic.

Many Thanks in Advance & Best Regards
Sheni R Meledath
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Array variable in Javascript & PHP

2002-07-29 Thread Sheni R. Meledath

Hello:

In a form I am using a series of check boxes for a number of lists. Some 
calculations has to be done on the client side using Javascript depending 
upon the check box values. For this I am using a single variable name 
(array) for the check boxes in a list and another for the next list and so 
on. The format I have used is
 
Education
 
Profession

I can access these variables from Javascript as list1[0] & list1[1].
(document.form.list1['0'].checked & document.form.list1['1'].checked

But when this form is submitted to the PHP script I am getting only the 
last value. list1 = 'Profession'. I am not getting an array of values.


How can I accomplish both these operations? I cannot use single variables 
names for each item in the form, because it is more than 1000. Also I want 
to use both Javascript & PHP operations. Please help to solve this issue or 
suggest some other ways to accomplish this business logic.

Many Thanks in Advance & Best Regards
Sheni R Meledath
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php