RE: [PHP] How can I use php codes in javascript?
| From: | Peter | Date: | Thu, 20 Jun 2002 01:06:51 +0000 |
| Subject: | RE: [PHP] How can I use php codes in javascript? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-103053@lists.php.net to get a copy of this message | ||
>I want to use php codes in a java function. Could you help me please. How
>can I do this? is this possible? if it is, is there any example about this
>on the Internet?
just do it the same as you would when using php in html ...eg
<script language="JavaScript">
<!--
//very simple example
document.write('Hello <? echo $user; if (!$user){echo "Guest"; } ?> welcome
to my page');
//-->
</script>
as you can see this is a very basic example but am sure you get the idea :)
Cheers
Peter