Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 2000051

Re: [PHP3] returning value from php3 to HTML (src attrib of img tag) From: Jean de Lavarene (breux <email protected>)
Date: 05/12/00

I am not sure this is what you wanna do but here are
my comments :

1. In the trial.html file :

 HTML file: trial.html
 -----------------------
 <html>
 <head>
 <title>trial</title>
 </head>

<body>

 <a href="http://webserver/trial.php3?a=1">
<img src="http://webserver/image.gif">
 </a>

 </body>
 </html>

2. In the trial.php3 file what you can do is:

<?
if ($a!=1) {
    print "<img src=\"orangebox.gif\">";
}
else {
    print "<img src=\"blubox.gif\">";
 }

----- Original Message -----
From: "Navneet Kumar" <navneetkumar <email protected>>
To: "PHPMailingList" <php3 <email protected>>
Sent: Saturday, May 13, 2000 4:08 PM
Subject: [PHP3] returning value from php3 to HTML (src attrib of img tag)

> hi PHPers,
>
> There is a need to change an image dynamically in an HTML page. Thus, the
> SRC attribute of the IMG tag points to a php3 file on the webserver. There
> are a few parameters passed to the php3 file depending on which I decide
the
> name of the image file and want to return the same (to the SRC attrib) so
> that the image will change dynamically. A sample of the HTML and the
called
> PHP file is also pasted below:
>
> HTML file: trial.html
> -----------------------
> <html>
> <head>
> <title>trial</title>
> </head>
>
> <body>
>
> <a href="http://webserver/trial.php3?a=1">
> <img src="http://webserver/trial.php3?a=1">
> </a>
>
> </body>
> </html>
>
>
> PHP file: trial.php3
> ---------------------
>
> <?
> if ($a!=1) {
> ?>
> orangebox.gif
> <?
> }
> else {
> ?>
> blubox.gif
> <?
> }
> ?>
>
> ----------------------------------------------------------------------
>
> Please note that both the image files are in the same directory as the php
> file, I have tried absolute paths also for the images but no result. But,
> please note that the php script does gets called --- I tested it by
> including a row insertion routine on the mySQL server trial database and
it
> did it!!And that was not after clicking because of HREF but even w/o that
> even on refresh it inserted rows.
>
> So, the question is: Can php return a value (image path) back to HTML SRC
> attrib of the IMG tag?
> If yes, how? If not, what is the workaround??
>
>
> thanks in advance
>
> porky
>
>
> --
> PHP 3 Mailing List <http://www.php.net/>
> To unsubscribe, send an empty message to php3-unsubscribe <email protected>
> To subscribe to the digest, e-mail: php3-digest-subscribe <email protected>
> To search the mailing list archive, go to:
http://www.php.net/mailsearch.php3
> To contact the list administrators, e-mail: php-list-admin <email protected>
>
>

-- 
PHP 3 Mailing List <http://www.php.net/>
To unsubscribe, send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest, e-mail: php3-digest-subscribe <email protected>
To search the mailing list archive, go to: http://www.php.net/mailsearch.php3
To contact the list administrators, e-mail: php-list-admin <email protected>