One way I do this is with the following:

if ($submit) {
        // Create a php array.
        $t_array = explode(",",$x_array);

<script language=javascript>
var x = new Array();
x[0] = "zero";
x[1] = "one";
x[2] = "two";

<form name=f method=post>
<input type=submit name=submit>
<input type=hidden name=x_array>

Use an onSubmit clause in the form tag to execute a function that
sets any hidden form values you need. This little test just falls
through but it doesn't have to.

<script language=javascript>
// set the hidden input to a comma delimited string
document.f.x_array.value = x.toString();

// alert(document.f.x_array.value);

Hope this helps.


-----Original Message-----
From: fitiux [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 13, 2001 4:54 PM
To: PHP General
Subject: [PHP] javascript to php ????

Hi  =)

is it possible to pass a javascript array to php ???


PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to