One way I do this is with the following:
<?php
if ($submit) {
// Create a php array.
$t_array = explode(",",$x_array);
print_r($t_array);
exit;
}
?>
<html>
<head>
<script language=javascript>
var x = new Array();
x[0] = "zero";
x[1] = "one";
x[2] = "two";
</script>
</head>
<body>
<form name=f method=post>
<input type=submit name=submit>
<input type=hidden name=x_array>
</form>
<!--
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);
</script>
</body>
</html>
Hope this helps.
Dean
-----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 ???
thanks.
--
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]