Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Hyperlink in the table view of records in php

Featured Replies

Let’s see if I can explain this in a coherent manner. I am displaying fields in a table view of records in a php webpage. I need to hyperlink the values in the table with calculated values using other field values. Is this possible?

 

And example of part of the code is:

...

 

 <?php
                                                            $recnum = 1;
                                                            foreach ($records as $fmrecord) {
                                                                    $record = new RecordHighlighter($fmrecord, $cgi);
 
                                                                    $rowclass = ($recnum % 2 == 0) ? "table_row" : "alt_row";
                                                                    $recid = $record->getRecordId();
                                                                    $pos = strpos($recid, "RID_!");
                                                                    if ($pos !== false) {
                                                                         $recid = substr($recid,0,5) . urlencode(substr($recid,strlen("RID_!")));
                                                                    }
                                                            ?>
                                    <tr class="<?php echo $rowclass ?>">
                                        <td class="browse_cell left">
                                            <?php echo nl2br(str_replace(' ', '&nbsp; ', $record->getField('NT', 0) ))?>
                                        </td>
                                        <td class="browse_cell left">
                                            <?php echo nl2br(str_replace(' ', '&nbsp; ', $record->getField('Track 1', 0) ))?>
                                        </td>
                                        <td class="browse_cell right">
                                            <?php echo nl2br(str_replace(' ', '&nbsp; ', $record->getField('Track 2', 0) ))?>
...
 
So what I need is that when it displays the records the value in field “NT” for instance, is a hyperlink that is calculated in "Field X"
 
I am hoping this is easy and I think I have done it before, but my brain isn’t working due to lack of sleep. 
 
Help!!! And thanks. 

Solved by webko

Go to solution
  • Solution

If that field is on the layout, then something like:

<a href="<?php echo $record->getField('FieldX')?>"><?php echo nl2br(str_replace(' ', '&nbsp; ', $record->getField('NT', 0) ))?></a>

Should do the trick (assuming it's a full or relative hyperlink) - might need the , 0 bit as well?

  • Author

Ah, that’s it. Thanks. I knew it was easy. Really appreciate it. 

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.