Actually, it's even more simple ... forgive me: echo '<script type="text/javascript">var myPHPvar='.json_encode($myPHPvar).';</script>';
that's pretty much it > From: an_...@hotmail.com > To: jonathan.desarro...@gmail.com; mail2gautambha...@gmail.com > CC: saeed....@gmail.com; php-general@lists.php.net > Date: Fri, 18 Sep 2009 13:01:28 +0200 > Subject: RE: [PHP] how i assign a js variable to a php variable > > > > > basicly is use hidden inputs as a container for php variables, and transform > > through js. > > really? I though the other way round was extremely simple: > > echo '<script type="text/javascript">var > myPHPvar=eval("('.addslashes(json_encode($myPHPvar)).')");</script>'; > > why would you use hidden input, plus DOM to get data, etc, etc? > > _________________________________________________________________ > Show them the way! Add maps and directions to your party invites. > http://www.microsoft.com/windows/windowslive/products/events.aspx _________________________________________________________________ With Windows Live, you can organize, edit, and share your photos. http://www.microsoft.com/middleeast/windows/windowslive/products/photo-gallery-edit.aspx