chockmilk
asked on
Using PHP to get Javascript Array
Hi i have javascript Array for and i would like to pass it to the next page which is coded in PHP
Problem is I tried methods found in this site but all seem out of luck
In HTML JAVASCRIPT PAGE
blendArray = (1,2,3,4,5,6,7,8);
function setValue(){
document.test.arv.value = blendArray;
alert (document.test.arv.value);
}
<form action="phpArrayTest.php" method=post name=test onSubmit=setValue()>
<input name=arv type=hidden>
<input type=submit>
In PHP i use
$getArray = $_POST['arv'];
and print out $getArray but nothing shown.
Problem is I tried methods found in this site but all seem out of luck
In HTML JAVASCRIPT PAGE
blendArray = (1,2,3,4,5,6,7,8);
function setValue(){
document.test.arv.value = blendArray;
alert (document.test.arv.value);
}
<form action="phpArrayTest.php" method=post name=test onSubmit=setValue()>
<input name=arv type=hidden>
<input type=submit>
In PHP i use
$getArray = $_POST['arv'];
and print out $getArray but nothing shown.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yikes :)
ASKER
thanks alot guy for helping me out
document.forms['test'] .arv.value = blendArray.join(";");
And in php use:
$getArray = explode(';', $_POST['arv']);
-r-