473,405 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

IF Statement to display image

Hey, new to the forum, have looked everywhere for some information of the following query but can't find it anywhere...

Within a site I am building a division calls on an include function to display a webpage ($page), so only the one template page is used throughout the entire site. It has been all smooth sailing up until I wanted to have a MouseOver image (image.src), become "selected" upon requesting its specific page.

[PHP]<? if ($page = 'pagename') {
echo
'<img src="imageM.jpg name="image" border="0">';
}
else {
echo
'<a onMouseOver="image.src='imageM.jpg';" onMouseOut="image.src='image.jpg';"><img src="image.src name="image" border="0"></a>';
}
?>[/PHP]


It is within a table division if that means anything...
oh, and its all on one line, not like above...

Cheers
Nov 27 '06 #1
1 9523
[PHP]<? if ($page = 'pagename') {
echo
'<img src="imageM.jpg" name="image" border="0">';
}
else {
echo
'<a onMouseOver="image.src=&#39imageM.jpg'" onMouseOut="image.src=&#39image.jpg'"><img src="image.src" name="image" border="0"></a>';
}
?>[/PHP]
I changed the internal 's to &#39 . This allows the html to have the apostrophe but doesn't interfere with the PHP code.
Also in both <img> tags, the src attribute only had a quotation before it, non after it, so I fixed that too.
Nov 27 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Tyrone Slothrop | last post by:
I am coding a site which involves uploading images. All of the PHP and display is OK but the client wants to be able to display the image thumbnail on the upload page and show the full image on...
3
by: gamerman0203 | last post by:
I'm new to asp so this could be an obvious answer. how would I write and "if-then-else" statement in vbscript for my asp pages? what I'm doing is pulling data from an access db and displaying...
4
by: Kevin Myers | last post by:
Hello, Please forgive my reposting of this note with hopefully a more relevant subject line. On an Access 2000 form under Windows 2000 I would like to use a Kodak Image Edit Control to...
5
by: Peter Lapic | last post by:
I have to create a image web service that when it receives an imageid parameter it will return a gif image from a file that has been stored on the server. The client will be an asp.net web page...
3
by: den 2005 | last post by:
Hi everyone, Here is code working on..Trying to insert record with a column with Image or VarBinary datatype in sql database from a existing jpeg image file, then retrieve this image from...
3
by: c676228 | last post by:
Hi everyone, I have a piece of code in sales.aspx.vb like this: Protected WithEvents Message As System.Web.UI.WebControls.Label Try ... ChartImage.ImageUrl = "ChartGenerator.aspx?" + DataStr +...
4
by: bokke | last post by:
Hi, I have a page that has several stories that run on it from a mysql database. Right now I use this code: <img src="Images/NewsPics/<?php echo $row;?>.jpg" border="1"to display the image. ...
3
by: cmt | last post by:
I am trying to display an image link based on the day of the week. My code gets the days for today, yesterday, and tomorrow and also today's hour. Note: function returns 1 if image link...
11
by: simon2x1 | last post by:
i have 3 pages,home.php, next.php page and other.php.in the home.php page i selected name from the database and i gave it a limit and also an if statement to echo next.for the next.php page and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.