Jump to content

link echo row from database = "value" from other row?


Ansel_Tk1

Recommended Posts

Hi all - I am creating a list that will use dynamic data from a table as link values. Is there a way for me to only create the link if the value from another field in the row = "Y"?

my link in the repeating region is:
<?php echo $row_rsalumni_database1['address_email']; ?>

but I only want the link if the value from $row_rsalumni_database1['display_email'] is "Y".

Hope this makes sense - any pointers?

Thanks!
Thank you so much for your help. One follow up question though - if the value of 'display_email' is not "Y", is there a way to prevent a blank link from coming up at all? As it is, if the value of display_email for the row = N than the link displayed on fullname is just 'mailto:'

I have tried putting the if before the <a href> tag but nada. Here is what I have:

<div align="left"><a href="mailto:<?php if($row_rsalumni_database1['display_email'] == "Y") {
echo $row_rsalumni_database1['address_email'];
} ?>"><?php echo KT_FormatForList($row_rsalumni_database1['fullname'], 20); ?></a></div>

thank you again for your help!
Then change this:
[code] <div align="left"><a href="mailto:<?php if($row_rsalumni_database1['display_email'] == "Y") {
echo $row_rsalumni_database1['address_email'];
} ?>"><?php echo KT_FormatForList($row_rsalumni_database1['fullname'], 20); ?></a></div>
[/code]
to:
[code]<?php
if($row_rsalumni_database1['display_email'] == "Y")
{
    echo '<div align="left"><a href="mailto:' . $row_rsalumni_database1['address_email'] . '">';
    echo KT_FormatForList($row_rsalumni_database1['fullname'], 20) . '</a></div>';
}
?>[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.