Re: javascript & php
| From: | Thomas Seifert | Date: | Mon, 28 Jul 2003 12:55:43 +0000 |
| Subject: | Re: javascript & php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-157157@lists.php.net to get a copy of this message | ||
On Mon, 28 Jul 2003 12:48:04 +0200 rduriancik@indprop.gov.sk (Roman Duriancik) wrote:
> I have problem with variables in javascript and php.
> I have code in php and in this code I insert some values from javascript.:
>
> $color = "<script><!--
> document.write(screen.colorDepth)
> //-->
> </script>";
>
>
> when I write command echo $color - result is correct.
>
> but when i need insert or select some values from database with this
> value ($color) result is not correct
You are doing it just wrong.
The PHP-code is executed and returns the html-page (with the JS-code if you use the print/echo
command) to the user
Afterwards the JavaScript-Code is executed ON THE CLIENT and shows the color in the page.
So the color never reaches the php-script.
Get a good book on how JavaScript works at all.
thomas