Reply to Re: Assigning PHP var to Javascript

Your name:

Reply:


Posted by Michael Fesser on 10/30/07 02:04

..oO(David Williams)

>I still do not really understand but am going to study what you wrote.
>
>The reason I kept overwriting was just to get this output
>correct. In my final code, I am writing to an array different values.
>But to take as much ambiguity out of the code that I could, I simplified
>it to that.
>
>Now, to the code:
>
>
> echo "abc='".addslashes($temp_image_name)."';";
>
> echo " blah "; // the code in its most simplest form
> which outputed will be a Java statement
> echo "abc= <blah>"; // if php does not talk to JS, how does
> php know what abc is ?

It looks like there's a fundamental problem of understanding how the
things work between the server and the client.

Think of an HTML page as if it would be just plain text, and in fact it
actually is - more or less. It's entirely up to the browser to do
something useful with that received text. The server couldn't care less
about what happens on the client side. All your PHP script can do is to
generate such text and send it to the browser. That's it.

This text can be plain HTML, but may also contain some more stuff like
JavaScript for example. But this is an entirely client-specific thing.
For your PHP script it's just meaningless text, a bunch of strings to
print. HTML, JavaScript etc. have no meaning in PHP, the interpreter
doesn't know about such things. There's also no direct communication
between the PHP script and the browser, so your script doesn't know what
happens on the client or how the received text will be handled. It just
creates the text - and that's it.

Micha

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация