Re: Array in PHP and Javascript
| From: | elias | Date: | Wed, 09 May 2001 16:21:53 +0000 |
| Subject: | Re: Array in PHP and Javascript | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-52033@lists.php.net to get a copy of this message | ||
Hi there....
There are lots of way that a PHP script can pass arrays to JavaScript...
you can output the array to javascript like:
$fls is an array.
<script>
rnd_imagesnames = new Array(
<?
for ($i = 0; $i < $count; $i++)
{
echo "'" . $fls[$i] . "'";
if ($i != $count - 1)
echo ",";
}
?>); // array statment closing
</script>
that's an example...
take a look at the 'rndimg' example using PHP & JavaScript...
-elias
http://ww.eassoft.cjb.net
""Reuben D Budiardja"" <reubendb@goshen.edu> wrote in message
news:20010509.574500@devcorps2.goshen.edu...
Hello,
I have a question here. Can I pass an Array (php) to a javascript
function, and then process the array there using javascript? How do I
access the php array in javascript then?
Say, all I want a do is to iterate through the array and build a string
using javascript, for example.
How do I pass the array to the javascript function? If someone could help
me, I would really appreciate it.
Thanks in advance.
Reuben D. Budiardja
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net