I've set up an ENUM column in my MySql database with a value of either 'y' (yes) or 'n' (no)
I have managed to display this record in a php webpage and even modified it to display a dynamic check box which is ticked if the value is 'y'
<input <?php if (!(strcmp($row_rsallJobs['sign_good_condition'],"y"))) {echo "checked=\"checked\"";} ?> type="checkbox" name="good_con" id="good_con" />
What I really want to do is display images depending on the value. For example 'yes.jpg' if the value is 'y' and 'no.jpg' if the value is 'n'.
How can I do this? Could I modify the code above?
Thanks!
Wookie wrote:
What I really want to do is display images depending on the value. For example 'yes.jpg' if the value is 'y' and 'no.jpg' if the value is 'n'.
Use a simple conditional statement:
<img <?php if ($row_rsallJobs['sign_good_condition'] == "y") {
echo 'src="yes.jpg" alt="yes"';
} else {
echo 'src="no.jpg" alt="no"';
} ?> height="20" width="20" />I've tried to follow your instruction and come up with this:
<?php if (value$row_DetailRS1['photos_taken'] == "f") {
print "full";
} elseif (value$row_DetailRS1['photos_taken'] == "p") {
print "partial";
} else (value$row_DetailRS1['photos_taken'] == "n") {
print "none";
} ?>
But I'm getting this error message for the first line though:
Parse error: syntax error, unexpected T_VARIABLE
Do you know where I have gone wrong?
..sorry need some help.
I can´t get it workin.....
<img <?php $status="n";
if ($status == "y") {
echo 'src="stecker_on.png" alt="yes"';
} else {
echo 'src="stecker_off.png" alt="no"';
} ?> height="71" width="101" />
The image ist not showing... ideas ?
All I get ist some text showing:
height="71" width="101" />
MANY THANKS !!!!
North America
Europe, Middle East and Africa
Asia Pacific