You are here: Re: Scope of php variables outside <?php ?> blocks « PHP Programming Language « IT news, forums, messages
Re: Scope of php variables outside <?php ?> blocks

Posted by Jerry Stuckle on 08/22/06 02:04

shawn.ready@gmail.com wrote:
> Jerry Stuckle wrote:
>
>>Sure it will. All of your PHP code will be executed on the server, then
>>the page is sent to the client, where your javascript is executed. When
>>the page is resubmitted, all of your PHP code will be executed on the
>>server again, and the page is sent to the browser, where your javascript
>>is executed.
>>
>>And so on.
>>
>>Each time you load the page you start fresh.
>>
> Hi Jerry
>
> The page gets loaded once (am only loading it once during testing),
> then the php gets called on the load, now once it is loaded, the
> javascript UpdateMyMap() is called on the clients side repeatedly.
>

No it doesn't. By the time the page is loaded, the PHP has already
completed. ALL of the PHP code in your page.

> First time in it has
>
> $pidpoint contains "unique_String_1234", this is then overwitten with a
> difference value within the scope of this function, say it now stores
> "unique_String_5678". But, when the client calls the UpdateMyMap()
> again, $pidpoint contains "unique_String_1234" again. Thats not what I
> wanted, I need it to store the value I set it in the
> $pidpoint=$pidpointNext;

That's because no PHP code is executed. It has already been executed.

>
> Shawn
>

(Top posting fixed)

PHP runs on the server. By the time the client gets the page, ALL PHP
code has already been executed. And it won't be executed again until
you reload the page (unless you're using AJAX, which is another thing
altogether).

And please don't top post.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this 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

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