Trying to Hide an echoed image in css

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vflflyer
Forum Newbie
Posts: 11
Joined: Wed Nov 16, 2011 9:41 am

Trying to Hide an echoed image in css

Post by vflflyer »

I hope this makes sense! I am trying to hide an image (with css) so it does not print, when someone prints my form.
It seems to work if it is echoing text but once I change it to an image I have no luck. Here is the code

Code: Select all

<?php    
if ($_POST["submit"] == "Calculate" && $emptyvar != 1){
$roiBar = "<img src='../images/results.gif'>";
}
?>    

<div id="roiBar"><?php echo $roiBar ?></div>
Here is my print.css sheet

Code: Select all

@media print {
#roiBar{display:none;}
}
but it still shows
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Trying to Hide an echoed image in css

Post by social_experiment »

“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
vflflyer
Forum Newbie
Posts: 11
Joined: Wed Nov 16, 2011 9:41 am

Re: Trying to Hide an echoed image in css

Post by vflflyer »

I really do not know php at all, so that link you you pointed me to does not help me.
Livengood
Forum Newbie
Posts: 11
Joined: Tue Nov 01, 2011 2:48 pm

Re: Trying to Hide an echoed image in css

Post by Livengood »

Code: Select all

<?php    
if ($_POST["submit"] == "Calculate" && $emptyvar != 1){
$roiBar = "<img src='../images/results.gif' style='display:none;'>";
}
?>    

<div id="roiBar"><?php echo $roiBar ?></div>
I see what your trying to do, why dont you actually put the css in the html.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Trying to Hide an echoed image in css

Post by Celauran »

Livengood wrote:why dont you actually put the css in the html.
Because that's not where it belongs?
vflflyer
Forum Newbie
Posts: 11
Joined: Wed Nov 16, 2011 9:41 am

Re: Trying to Hide an echoed image in css

Post by vflflyer »

Livengood wrote:

Code: Select all

<?php    
if ($_POST["submit"] == "Calculate" && $emptyvar != 1){
$roiBar = "<img src='../images/results.gif' style='display:none;'>";
}
?>    

<div id="roiBar"><?php echo $roiBar ?></div>
I see what your trying to do, why dont you actually put the css in the html.
I want this to hide when someone wants to print it not hide it on the screen
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Trying to Hide an echoed image in css

Post by social_experiment »

http://imar.spaanjaars.com/240/how-do-i ... is-printed
My bad; i don't know how that url ended up being pasted but yeah :) Here is what i intended to paste.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply