Hi,
I want to pass an array of values from PHP to Javascript without using hidden fields.
Please somebody help.
Passing Data from PHP to Javascript
Moderator: General Moderators
use php to create a variable that will hold the values you want in javascript so that when the page loads you just echo out those values like a normal php but the variable will contain correct synatax for javascript ex.
make sense?
Code: Select all
<?php
for($x=0; $x<$someNum; $x++)
{
$jsArray.="//js array values";
}
?>
//html header stuff
<script language="javascript">
<? php echo $jsArray; ?>
</script>
//rest of html here