Reply to Re: PHP within javascript

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация