| 
 Posted by Shelly on 08/27/07 17:55 
<Morlaath@gmail.com> wrote in message  
news:1188234878.670476.139660@50g2000hsm.googlegroups.com... 
> Anytime I embed php within javascript with the <?php ?> tags the php 
> executes as soon as the page is loaded. So for instance if I have 
> something like the following. 
> 
> //Javascripts 
> function foo() { 
>    <?php session_destroy(); ?> 
> } 
> 
> <input type="button" value="logout" onclick="foo();"/> 
> 
> The 'session_destyoy()" is called as soon as the page is loaded, 
> instead of when you click on the button. 
> 
 
Try 
 
function foo() { 
    <?php echo "session_destroy();" ?> 
 
to write the javascript piece in the html area.
 
[Back to original message] 
 |