[thelist] getting a JS variable into PHP

Aleem Bawany aleem.bawany at utoronto.ca
Sat Dec 14 21:41:00 CST 2002

> heyo,
> I need to get a JavaScript variable value into a php
> variable. I have something like this:
> <some JS>
> var name = bob;
> </js>
> This is at the end of a function. My first thought was to do this:
> <? $phpVariable = ?>name<? ; ?>
> But I think it will choke at the end of the first delimter
> because its a statement that is not closed by a semicolon..
> anyone?

If the variable were in the URL, js and php can both access that. Just
one way to go about it. I don't know if it will choke by your method
(did you try it?) if it does you can use php heredoc:
$var = <<<EOT
blah "blah" 'blah'

just a thought. HTH.


[ http://members.evolt.org/aleem/ ]

More information about the thelist mailing list