2 Replies Latest reply on May 19, 2008 12:03 PM by (Sambo)

    Links only when hyperlink field exist

      Hi I have a database with say a text field and a hyperlink field.
      I want the text field to be the text in a hyperlink linking to the hyperlink field, BUT ONLY when the hyperlink field exists. if the hyperlink field DOES NOT exist, just display the text not as a empty hyperlink, but just as text.
      Any idea?
      Thanks alot for your help
      Dave
        • 1. Re: Links only when hyperlink field exist
          Level 1
          In PHP<br /><?php if (strlen($row_getPub['pub_url']) > 0) {?><br />          <a href="<?php echo $row_getPub['pub_url']; ?>"><br />            <?php }?><br />            <?php echo $row_getPub['pub_title']; ?><br />            </a><br />of course, substitute your connectionstring and table / field names.<br /><br />Jeff<br /><br /><br /><David_Ellis@adobeforums.com> wrote in message <br />news:59b54a66.-1@webcrossing.la2eafNXanI...<br />> Hi I have a database with say a text field and a hyperlink field.<br />> I want the text field to be the text in a hyperlink linking to the <br />> hyperlink field, BUT ONLY when the hyperlink field exists. if the <br />> hyperlink field DOES NOT exist, just display the text not as a empty <br />> hyperlink, but just as text.<br />> Any idea?<br />> Thanks alot for your help<br />> Dave
          • 2. Re: Links only when hyperlink field exist
            Level 1
            My reply was a little incomplete, of course you would have to have a <br />conditional statement on the closing <a> tag as well:<br /><br /><?php if (strlen($row_getPub['pub_url']) > 0) {?><br />          <a href="<?php echo $row_getPub['pub_url']; ?>"><br /><?php }?><br />            <?php echo $row_getPub['pub_title']; ?><br /><?php if (strlen($row_getPub['pub_url']) > 0) {?><br />            </a><br /><?php }?><br /><br />Jeff<br /><br /><br /><br /><David_Ellis@adobeforums.com> wrote in message <br />news:59b54a66.-1@webcrossing.la2eafNXanI...<br />> Hi I have a database with say a text field and a hyperlink field.<br />> I want the text field to be the text in a hyperlink linking to the <br />> hyperlink field, BUT ONLY when the hyperlink field exists. if the <br />> hyperlink field DOES NOT exist, just display the text not as a empty <br />> hyperlink, but just as text.<br />> Any idea?<br />> Thanks alot for your help<br />> Dave