laulau wrote:I have nothing in particular in "the oven"
I confused the php variables and those used in html pages
I've a lot to learn

That's ok. Let me try to explain a little and see if it helps.
There are many elements to a web page but the basic language of a web page is HTML and this is what is used to describe the page content and layout to your browser on your PC. When you open a web page your browser will expect HTML commands only. For the most part the HTML is sent to you from a web server so when you visit a web page the webserver sends HTML back.
Now, it may be the case that the web server does 'some magic' to produce the HTML, and your PC browser does not need to know any of this. One of the Magic things is PHP.
PHP only runs on a web server and never runs in the browser on the PC. So if a web page has PHP code in it, the webserver must deal with it and remove all the PHP code before sending to your browser (which only wants HTML).
So the job of PHP is to run some code (on the webserver) and produce HTML to be included in the final HTML sent to the web browser.
Simple Example
Code: Select all
<html>
<body>
<p>This is paragraph 1</p>
<?php
echo "<p>This is paragraph 2</p>";
?>
</body>
</html>
The webserver processes this page and finds PHP between the <?php...?> tags. A special PHP processer then steps in and executes the code, and in this case (echo) prints some text, which is also HTML.
The result sent to the browser for display is
Code: Select all
<html>
<body>
<p>This is paragraph 1</p>
<p>This is paragraph 2</p>
</body>
</html>
All the PHP is removed as the web server "ran" it and produced output -- and now only HTML exists for your browser.
So, in you case if you have a PHP variable '$graph', it never gets to the browser as it is removed. It is only useful while the server is building the HTML to send to you.
Javascript was added to the HTML standard to enhance it. Javascript, by contrast, runs only on the Browser on your PC and updates the page you are currently being shown. So in your case, you use Javascript to change the graph image on the page. The whole page is NEVER sent back to the server to be re-loaded, only the small change you made to the <IMG> tag in your browser.
So,
PHP manipulates the page on the server BEFORE the browser gets it.
Javascript works on the page AFTER the browser has it
Does that help? Let me know if something doesn't make sense