Re: php and javascript

From: Date: Fri, 27 Jul 2001 13:56:13 +0000
Subject: Re: php and javascript
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-59945@lists.php.net to get a copy of this message
I am not sure exactly what you are doing, but the thing to remember is that your PHP script is writing your HTML and JavaScript. As long as you keep that in mind it is fairly easy to see how to pass variables to JS. Here is a very simple example <?php $foo = "bar"; ?> <HTML> <Body> <Script language=Javascript> var foo = "<?php echo "$foo"; ?>"; document.writeln(foo); </Script> </Body> </HTML> If you need something more specific post some code. Sheridan Saint-Michel Website Administrator FoxJet, an ITW Company www.foxjet.com ----- Original Message ----- From: Karl Phillipson <Karl@SaffronHill.com> To: <php-general@lists.php.net> Sent: Friday, July 27, 2001 6:08 AM Subject: [PHP] php and javascript > > Does anyone know how to pass php variables to a javascript for processing. > > I have a DHTML menu system that requires variables be attached to the url > contained within it. Using echo does not print the variable to the url. > > Is there another way? > > Thx in advance. > > Karl > ========================== > Karl Phillipson > PHP SQL Programmer > > Saffron Hill Ventures > 67 Clerkenwell Road > London > EC1R 5BL > ========================== > >

« previous php.general (#59945) next »