Re: Variable assignment!
| From: | Ramender Kishore | Date: | Fri, 25 Aug 2000 04:20:20 +0000 |
| Subject: | Re: Variable assignment! | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13574@lists.php.net to get a copy of this message | ||
Y'know the thing didn't work and I was just trying out the small thing again and again and
finally left it out.
Yesterday, however, I tried something like the following:
<script language = "JavaScript">
function SomeFunction(someval)
{
alert(someval);
}
</script>
<?
$somevar = 4566;
?>
<html><head><title>some title</title></head><body>
javascript:SomeFunction(<? echo "$soemvar"; ?>)
</body>
</html>
and it did gimme an alert having the value "4566". How about that?
-Ramender Kishore
----- Original Message -----
From: cmoewes@moewes.com
To: Ramender Kishore
Cc: PHP Mail List
Sent: Wednesday, August 23, 2000 6:44 PM
Subject: Re: [PHP] Variable assignment!
What happened when you did that. The only thing that might have
happened is if the php variable was a tring, it doesn't appear that
you are using quotes around it
<script>
var someting = "<? echo $readmatter?>"
</script>
I see you have quotes inside the php section, but those get ised by
the echo statement. you could do
<? echo "/"$somematter/"" ?>
But that is harder to read.
On Wed, Aug 23, 2000 at 07:18:09PM +0530, Ramender Kishore wrote:
> How to assign a php variable's value to a javascript variable?
>
> This didn't work ... var somematter = <?php echo "$readmatter"; ?>