Reply to Re: PHP table cell onclick

Your name:

Reply:


Posted by Martin Adams on 07/22/07 09:48

Thing to remember is, if the HTML page has been downloaded to the web
browser, PHP is no longer running your script. If you want to do any client
processing (such as onclick events), you need to POST a data form back to
the PHP script and process it, or send a GET request to another script. I'd
say JavaScript is what you need to control what's on the page after it has
loaded.

Martin


"Rik" <luiheidsgoeroe@hotmail.com> wrote in message
news:op.tvprwpsfqnv3q9@metallium...
On Thu, 19 Jul 2007 15:27:49 +0200, screechyboy@googlemail.com
<screechyboy@googlemail.com> wrote:

> when they click on a cell in my table i would like to redifine a
> variable in php.
>
> So...
>
> <td onclick="<?php $color="White" ?>"></td>
> <?php echo $color ?>
>
> it doesnt wait for onclick before running the PHP so as soon as i load
> the page its prints White.
>
> I hope you can see what im trying to do... any help would be greatly
> appreciated!

PHP is server-side, not client-side. It sends a page 'as is', and can only
perform actions on the server itself. It doesn't care you have set it in
an 'onclick' HTML attribute, it could care less by what random content it
is surrounded. It builds a page and sends the result to the user.

You probably want javascript for this, something that does run on the
client's computer.
--
Rik Wasmus

[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

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