PHP Version: 4.3.4
Web Server: Apache/2.0.48 (Fedora 2)
Mambo Version: 4.5.1a Stable
On my form I have an inputbox where a user would type in a name. Below the inputbox I have a combobox where the user would make a selection. Following the combobox are two inputboxes that I want to have filled with values from a table in my database based on the combobox selection.
Here is what I have so far.
// admin.events.html.php
<input class="inputbox" type="text" name="title" size="50" maxlength="100" value="<?php echo $row->title; ?>" />
<?php mosEventsHTML::buildCategorySelect($row->catid, 'onChange="if(catColors[this.value])catColor=catColors[this.value]; else catColor=\'\';document.adminForm.useCatColor.onclick();"'); ?>
<input name="AdmissionName1" type="text" class="inputbox" id="AdmissionName1" title="Enter an admission name to appear on events page." value="<?php echo $myrow->adminname1; ?>" size="20" maxlength="20" />
<input name="AdmissionPrice1" type="text" class="inputbox" id="AdmissionPrice1" title="Enter a price for admission to appear on events page." value="<?php echo $myrow->adminprice1; ?>" size="10" maxlength="10" />
// events.class.php
<?php
function buildCategorySelect($catid, $args){
global $database, $gid, $option;
$catsql = "SELECT id AS value, name AS text FROM #__categories"
. "\nWHERE section='$option' AND access<='$gid' AND published='1' ORDER BY ordering";
// get list of categories
$categories[] = mosHTML::makeOption( '0', _CAL_LANG_EVENT_CHOOSE_CATEG );
$database->setQuery($catsql);
$categories = array_merge( $categories, $database->loadObjectList() );
$clist = mosHTML::selectList( $categories, 'catid', $args, 'value', 'text', $catid );
echo $clist;
}
?>
Any help would be greatly appriciated!