I'm trying since a lot of time, passing simple variables from php to JS.
I can find very often the following code.
Code: Select all
$size = GetImageSize("http://www.fiftiesweb.com/elvis-portrait2sm.jpg");
var pictureWidth = <?= $pictureWidth ?>; // or
var pictureWidth = <?PHP echo $pictureWidth; ?>; // or
var pictureWidth ="<?PHP echo $pictureWidth; ?>";
I tried this on two different php-servers. But I can't get it work.
What is the detail that I forgot ?
Or is it better with a $_GET or $_POST and hidden forms?
If so, does somebody know a simple working example to learn how to do.
I was hardly trying since three weeks to find something of these possibilitys.
No complete basic examples to find !!
Thanks in advance to all of you for your experience !!