PASSING VARIABLES AT THE END OF A URL FROM A DETAIL PAGE TO A LISTING PAGE - Mar 12th, 2017


Creating a link on a detail page that would show all off the records created by the author of that record on a new list
page.

ON THE DETAIL PAGE
First, create a variable from the createdByUserNum value on the detail page


<?php $member1 = $my_tableRecord['createdByUserNum'] ?>


Then append that variable's value, and the new variable to be passed along to the end of the Link URL


<a href="show-all-records-test1.php?member=<?php echo $member1 ?>">Show All records</a>


ON THE LISTING PAGE
Add this code before the list records call to define the value of the passed $member variable


<?php $member = $_REQUEST['member']; ?>


Then in the list records call, add a 'where' to filter the results to only those records that were created by that
author:


<?php // load records from 'my_table'

list($my_tableRecords, $my_tableMetaData) = getRecords(array(
'tableName' => 'my_table',
'loadUploads' => true,
'allowSearch' => true,
'orderBy' => 'createdDate DESC',
'where' => 'createdByUserNum = "'. $member .'"' ,
));
?>


The 'orderBy' => 'createdDate DESC', sorts the results with the newest at the top



The materials on this web site have been created for use with CMS Builder content management software. CMS Builder software is published and licensed for use by InteractiveTools.com. Please contact Interactive Tools for information on the downloading of the software or the purchasing of licenses.


Terms of Service