showing an image conditionally
Posted: Sun Oct 23, 2005 4:43 pm
I am trying to get my script to show an image if a field has an entry and to not show the image if the field does not have an entry. How could I do this?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
$image = $results["Image"];
if (empty($image)) {
echo "";
}
else {
echo "<img src='image/image.gif' ></a><bR>";
}Code: Select all
$email = $result["email"];
if (empty($email)) {
echo "";
}
else {
echo "<a href=\"mailto:$email\"><img src=\"images/mail.gif\" border=\"0\"></a> ";
}Code: Select all
$email = $result["email"];
if (empty($email)) {
echo "";
}
else {
echo "<a href=\"mailto:" . $email . "\"><img src=\"images/mail.gif\" border=\"0\"></a> ";
}Code: Select all
$image = $results["Image"];
$email = $results["'Email"];
if (empty($image)) {
echo "";
}
else {
echo "<a href="mailto:$email?subject=Subject Line"><img src='image/image.gif' ></a><bR>";
}Code: Select all
if (!empty($image)) {
echo "<img src=" //etc
}Code: Select all
if (isset($_POST['image'])) {
echo "<img src=" //etc
}