Hi all,
I’m still a noob at all of this stuff — at some point I may get better

.
I’m working on a site that looks at data from several different locations (most of which are in the main MODx database as non-MODx tables). I’ve got some data that I’m trying to use to populate a selectable drop down list to pull up coinciding data from another table (ie - a user can select from the list an item and then the data from the other table is populated below via a MySQL query in a nice & neat table - kinda like viewing a list of cities if you select a certain state/country, but not javascript.) Also, I’m basing this on having a registered user logged in who can only see the items from the list that they are allowed to see.
I’ve looked around and it seems like I should use a TV, but when I place the TV in my template it doesn’t create a drop down list, it only creates a list of the items. I’m hoping that I don’t have to do anything too crazy in PHP, but it may be necessary.
Also, is it possible to take the selection from the drop down and push it to the MySQL query in my snippet that pulls the rows from the table?
My demo site is
http://www.burningtreedesigns.com/mcni/ and the page I’m working on is
http://www.burningtreedesigns.com/mcni/index.php?id=112.
Any help is greatly appreciated.
Thanks,
Ashton
Additional info about my project
Here’s the TV that I’ve created:
Variable Name: [*qlinkAccts*]
Caption: The list of Qlink Accts
Description: A way to pull up the Qlink Acct users
Input Type: DropDown List Menu
Input Option Values: <empty>
Default Value: @SELECT DISTINCT qlink_acct FROM tmtrxfil
Widget: Delimited List
Widget Properties: Delimiter -
Other info:
Table 1: dmtotm
rows - id, user_id (same as MODx user_id from registration), qlink_acct
Table 2: tmtrxfil
rows - id, qlink_acct, sync_time, no_tickets, total_sales
Table 1 will need to look at Table 2 in order to select the appropriate qlink_acct.
Snippet - QlinkAcctViewer
<?php
//create variable for holding the output
$output = '';
$sql = $modx->db->query( 'SELECT * FROM `tmtrxfil` ORDER BY `sync_time` ASC LIMIT 35');
$resultArray = $modx->db->makeArray( $sql );
foreach($resultArray as $item)
{
$params['qlinkacct']=$item['qlink_acct'];
$params['synctime']=$item['sync_time'];
$params['notickets']=$item['no_tickets'];
$params['totalsales']=$item['total_sales'];
$output.=$modx->parseChunk('QlinkTpl', $params, '[+', '+]');
}
return $output;
?>