473,804 Members | 4,223 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IF Statement to display image

1 New Member
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="im age.src='imageM .jpg';" onMouseOut="ima ge.src='image.j pg';"><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 9784
TheMadMidget
98 New Member
[PHP]<? if ($page = 'pagename') {
echo
'<img src="imageM.jpg " name="image" border="0">';
}
else {
echo
'<a onMouseOver="im age.src=&#39imageM.jpg'" onMouseOut="ima ge.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
6776
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 mouseOver instead of the popup I coded. The section of code below works perfectly in Firefox but not at all in IE (why am I not surprised?). The page is nearly 100% dynamic, so this is extracted from the source of a test page. The code in...
3
1715
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 it. in access, my fields that are yes/no fields (checkboxs) show up as true or false on my page. Is there anyway to turn those true or false statements into an image? ie. if -variableX-=true, then display -imageX-, else display -imageY-
4
8385
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 display the contents of a TIFF image file. According to the very limited documentation that I have been able to locate so far, all I should need to do is to drop the Image Edit Control onto the form in design mode, set the control's Image property to...
5
5050
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 that calls the web service to render a vertical strip of images. After doing some research I am unable to find some vb.net code that can assist in what I want to achieve. The closest thing I found was
3
5249
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 database and display it in a Image web control dynamically(at runtime). The process after being displayed in the web control, user click insert/add button, it converts the image(jpeg) file to bytes and store it the database with Image or VarBinary...
3
2252
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 + "&ChartType=" + drpChartType.SelectedItem.Value.ToLower() + "&Print=" + printVersion.ToString() ... Catch e As Exception
4
1610
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. BUT I have added a column to the database with 1 or 2 (1=has pic, 2=no pic). I would like to use an IF STATEMENT - so that: <?php
3
2381
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 should work function returns 0 if image link should be disabled It should display the image link if:
11
2206
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 other.php i did the same thing but i indicate (where comp_id >3 limit 3) for next page (where comp_id >6 limit 3) for other page so as to display the next 3 name repectively and also echo next and back to go the previous page.how can i put these...
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10332
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10320
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9150
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5521
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2991
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.