You are here: Re: can I pass PHP var to JS ...? « All PHP « IT news, forums, messages
Re: can I pass PHP var to JS ...?

Posted by Tom on 03/07/07 18:01

On Tue, 06 Mar 2007 04:47:35 GMT, Tamarin wrote...
>
>Hello,
>
>new @ php and was wondering if I can pass on a PHP variable to Javascript
>for returning an IP number in a form. I use a PHP snippet below to advise
>potential members of a forum that their IP is being recorded (as all
>web-servers are capable of), but I am wondering if there is some way to pass
>the PHP variable to a hidden form-field variable that would return the IP
>number via the form processor?
>
>here is the IP image generator, "ip_number.php"
>========================
>
><?php
>$img_number = imagecreate(310,25);
>$backcolor = imagecolorallocate($img_number,197,215,218);
>$textcolor = imagecolorallocate($img_number,0,0,128);
>
>imagefill($img_number,0,0,$backcolor);
>$number = " Your IP number is $_SERVER[REMOTE_ADDR]";
>
>Imagestring($img_number,10,5,5,$number,$textcolor);
>
>header("Content-type: image/jpeg");
>imagejpeg($img_number);
>?>
>
>================================
>I reference this file to display the image in my application like so:
><p align="center"><img src="../ip_number.php" border="1"></p>
>
>thanks for any assistance with this question.
>
>TM
>
>

PHP is parsed on the server so you can use PHP to create dynamic content in HTML
and Javascript before the document is sent back.

Tom
--
Newsguy.com
75+ days of Binary and Text Retention!
Higher levels of article completion!
Broader coverage of newsgroups

 

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

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