Page 1 of 1

Trying to Hide an echoed image in css

Posted: Tue Nov 22, 2011 9:15 pm
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

Re: Trying to Hide an echoed image in css

Posted: Wed Nov 23, 2011 12:35 am
by social_experiment

Re: Trying to Hide an echoed image in css

Posted: Thu Nov 24, 2011 12:27 pm
by vflflyer
I really do not know php at all, so that link you you pointed me to does not help me.

Re: Trying to Hide an echoed image in css

Posted: Thu Nov 24, 2011 2:11 pm
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.

Re: Trying to Hide an echoed image in css

Posted: Thu Nov 24, 2011 2:21 pm
by Celauran
Livengood wrote:why dont you actually put the css in the html.
Because that's not where it belongs?

Re: Trying to Hide an echoed image in css

Posted: Thu Nov 24, 2011 2:24 pm
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

Re: Trying to Hide an echoed image in css

Posted: Thu Nov 24, 2011 4:16 pm
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.