problem with HTML & PHP please help me

varaprasadreddy's Avatar
Light Poster
Dear friends/moderators

I am developing a page. In that page at some location one image will be displayed. The image will change according to date & month. For changing the image i am using php script. The problem is, i am unable to integrate the file location in the html file.

php code:
-------------------------------------------------------------------------------------------
<?php

$holidays = array(
'01-01' => 'newyear',
'02-14' => 'valentines',
'03-17' => 'saintpatricks',
'04-12' => 'easter',
'12-25' => 'christmas',
);

$date = date('m-d');

if (isset($holidays[$date])) {$logo = 'holidays/logo_' . $holidays[$date] . '.gif';}
else {$logo = 'holidays/logo_default.gif';}

echo '<img src="' . $logo . '">';
?>
-----------------------------------------------------------------------------------------
I saved this code holidays.php
I want to integrate the path of the php in the below code at

<IMG SRC="holidays/IMAG003.JPG" WIDTH=533 HEIGHT=335 BORDER=0>

in the above line already another image is there it was in red color & it should be changed with another image as in the php code.
I inserted like this but not working

<IMG SRC="holidays.php" WIDTH=533 HEIGHT=335 BORDER=0>



html code in my page
---------------------------------------------------------------------------------------
<DIV ID="SGROBJ7D9431612262221" STYLE=" position:absolute; top:160px; left:232px; width:533px; height:335px; z-index:3;">
<IMG SRC="images/IMAG003.JPG" WIDTH=533 HEIGHT=335 BORDER=0>
</DIV>
-----------------------------------------------------------------------------------------
I n the above html code how to change for working the php code.

please help me. I had this trouble since one week.
waiting for your replies
thanks in advance.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Does your holidays.php output image url as

echo '<img src="' . $logo . '">';

But you expect only the $logo url and so you should see that logic
0
varaprasadreddy's Avatar
Light Poster
Sir this is working for me in php when i executed but i was unable to use in html for changing the image.
Sorry sir i dont know php & i am new to this please help me.
waiting for ur reply.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
When you use the following code

<IMG SRC="holidays.php" WIDTH=533 HEIGHT=335 BORDER=0>

The output becomes

<IMG SRC="<img src="holidays/logo_default.gif">" WIDTH=533 HEIGHT=335 BORDER=0>

I hope this helps and you understand what is wrong
0
varaprasadreddy's Avatar
Light Poster
sir it is not working, my be i didn't explained properly for you.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
So then try to explain because its difficult to read your mind.
0
varaprasadreddy's Avatar
Light Poster
<?php

$holidays = array(
'01-01' => 'newyear',
'02-14' => 'valentines',
'03-17' => 'saintpatricks',
'04-12' => 'easter',
'12-25' => 'christmas',
);

$date = date('m-d');

if (isset($holidays[$date])) {$logo = 'holidays/logo_' . $holidays[$date] . '.gif';}
else {$logo = 'holidays/logo_default.gif';}

echo '<img src="' . $logo . '">';
?>


Sir the above code is executing in php. So i want to execute through the html page i.e.
take a new html page named as some xxxxx if i open that page the above program should be executed
at certain position in the page like top=100, left/right= 200 (x,y axis) with a particular size of the image because all the images will not be in the same size.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Just including the file should do it.
0
varaprasadreddy's Avatar
Light Poster
sir i dont how how to include the file please help me how tot include the file in html with in the body.
aiting for ur reply.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
inlcude('path/to/file')