Hi Jason,
Well I’ve upped the ante and I’m stuck again...
This time I’m trying to populate the options in the pull down list from the values in a master list table.
The options in the list work OK but I’m not sure how to get them to populate the $where, when using what I think is a modified version of the original substitution idea that was suggested for security.
$where = "";
if (@$FORM['where'] == 'a') { $where = 'Test Event 1'; }
if (@$FORM['where'] == 'b') { $where = 'Test Event 2'; }
list($client_uploadsRecords, $client_uploadsMetaData) = getRecords(array(
'tableName' => 'client_uploads',
'where' => " project_title = '$where'",
));
I’m trying to use the record number as the substitution value, and the record title as the actual $where value, and I’m sure that the code I guessed at is not right at all.
At the top of the page, I added :
list($master_exhibition_listRecords, $master_exhibition_listMetaData) = getRecords(array(
'tableName' => 'master_exhibition_list',
));
$names = array();
foreach ($master_exhibition_listRecords as $record){
$names[$record['title']]=$record['title'];
$numbers[$record['num']]=$record['num'];
}
?>
<?php
$where = "";
?>
// This is the code that’s I guessed at and which doesn’t work.
<?php foreach ($master_exhibition_listRecords as $record): ?>
<?php if (@$FORM['where'] == $record['num'] { $where = $record['title']}); ?>
<?php endforeach; ?>
//end non-working code
<?php
list($client_uploadsRecords, $client_uploadsMetaData) = getRecords(array(
'tableName' => 'client_uploads',
'where' => " project_title = '$where'",
));
?>
And in the form:
<form method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<select type="text" name="where">
<option value=""><span class="body-text-bold">Select</span></option>
<?php foreach($names as $name): ?>
<option value="<?php echo $umbers;?>"><?php echo $name;?></option>
<?php endforeach?>
</select>
<input type="submit" name="submit" value="Select An Exhibition And Click To View">
</form>
Thanks,
Jerry Kornbluth
The first CMS Builder reference book is now available on-line!
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php