Jump to content

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]
Hmm not sure, would this work?


[code] <?php
if($row_rsalumni_database1['display_email'] == "Y")
{
    echo '<a href="mailto:' . $row_rsalumni_database1['address_email'] . '">';
}
else
{
    echo "$row_rsalumni_database1['address_email']";
}
?>[/code]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.