RE: [PHP-WIN] HTML/PHP/Javascript
| From: | Mike Flynn | Date: | Thu, 10 May 2001 01:58:12 +0000 |
| Subject: | RE: [PHP-WIN] HTML/PHP/Javascript | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-7430@lists.php.net to get a copy of this message | ||
Not only that, but Bob, PHP is a *server-side* language. That means that all computing is done on the server before ever even being sent to the user. You can't call PHP on the fly -- it's done when the user requests the file, and then the resulting HTML is what the user gets. On the other hand, JavaScript is a CLIENT-SIDE language, meaning it doesn't do anything on the server, it simply manipulates the HTML that the user has already gotten. You can have PHP affect the script on the resulting page the user gets before the page is sent, but you can't have JavaScript to anything with PHP, besides opening or redirecting to a new PHP page with particular parameters.
For example, in terms of PHP affecting JavaScript.. I created an image database where users can upload images, and when they do the file info (file name, description, file size, image width, image height, file type) are stored in the database. When the users go to browse the images, there is JavaScript code which PHP dynamically populates with all of the image data, so that the users can preview all of the images and their info without reloading the page. That's an example of PHP influencing the resulting JavaScript. But JavaScript can't affect PHP, because the PHP is all computed on the server side before ever reaching the user, whereas JavaScript is executed on the user's side.
Hope that clears things up.
-Mike
At 11:32 AM 5/10/01 +1000, Ignatius Teo wrote:
Wouldn't it be simpler to have your PHP function in a discrete script file and call: <a href="javascript:void(0)" onClick="NewWindow('myscript.php'); return false"></a> Put on your thinking caps.Today's alienated gem: "Send your favorite mom lots of love and affection, free of shipping charges!" -- Seen on a shopping site
-=- Mike Flynn - Burlington, VT -=-mike@mikeflynn.net http://www.mikeflynn.net/ * Give blood * Wouldn't the free market, in its true form, be anarchy?