RE: [PHP] Array Javascript

From: Date: Thu, 05 Sep 2002 11:27:33 +0000
Subject: RE: [PHP] Array Javascript
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-115289@lists.php.net to get a copy of this message
Hi To Assign values from an array in PHP to JavaScript, you could try something like this. $Array = array( 'one', 'two', 'three' ); Now in your JavaScript: <SCRIPT LANGUAGE="JavaScript"> JSArray = new Array(<?= sizeof( $Array )?>); <?php for ( $iSubscript = 0; $iSubscript < sizeof( $Array ); $iSubscript++ ) { // Add each member of the php array to the JS array echo 'JSArray['.$iSubscript.'] = "'.$Array[$iSubscript].'";'; } ?> </SCRIPT> Regards -|Scott > -----Original Message----- > From: kale [mailto:kaleonardo@home.ro] > Sent: Thursday, September 05, 2002 1:12 PM > To: php-general@lists.php.net > Subject: [PHP] Array Javascript > > > Hy, > I have an array make with a javascript. > How can I read values with PHP from it? > Kale. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#115289) next »