decho("INSERT INTO `rudi_awards` SET `class_id` = '{$class_id}', `name` = '{$name}', `description` = '{$text}'");
    $db->Query("INSERT INTO `rudi_awards` SET `class_id` = '{$class_id}', `name` = '{$name}', `image` = '', `description` = '{$text}'");
    PageRedirect(1, "?op=rudi&show=awards&cid=" . $class_id);
    return;
}
echo LinkInternal("Cancel", "?op=rudi&show=awards&cid=" . $class_id);
OpenTable();
?>

<tr><th>Name:</th><td><?php 
$form->textField('name', "", false, "50");
?>
</td><tr>
<tr><th>Image:</th><td><?php 
?>
</td></tr>
<tr><th>Text:</th><td><?php 
$form->textArea('text', 10, 30);
?>
</td></tr>
<tr><td><?php 
$form->submitButton('processed', 'Add');
?>
</td></tr>

<?php 
CloseTable();
$form->__destruct();
?>

    $text = $form->request['text'];
    $db->Query("UPDATE `rudi_awards` SET `name` = '{$name}', `description` = '{$text}' WHERE `award_id` = '{$award_id}' LIMIT 1");
    PageRedirect(1, "?op=rudi&show=awards&award={$award_id}");
    return;
}
echo LinkInternal("Cancel", "?op=rudi&show=awards&cid={$award['class_id']}");
OpenTable();
?>

<tr><th>Name:</th><td><?php 
$form->textField('name', $award['name'], false, "50");
?>
</td><tr>
<tr><th>Image:</th><td><?php 
?>
</td></tr>
<tr><th>Text:</th><td><?php 
$form->textArea('text', 10, 30, $award['description']);
?>
</td></tr>
<tr><td><?php 
$form->submitButton('processed', 'Update');
?>
</td></tr>

<?php 
CloseTable();
$form->__destruct();
?>

function AddAwardRecord($member_id)
{
    global $db;
    $form = new BayonetForm("", "POST");
    if ($form->verifySubmit('processed')) {
        $date = $form->request['date'];
        $details = $form->request['details'];
        $award_id = $_POST['award'];
        decho($form->request);
        $db->Query("INSERT INTO `rudi_award_record` SET `member_id` = '{$member_id}', `award_id` = '{$award_id}', `date_added` = '{$date}', `record_note` = '{$details}', `added_by` = 1");
        PageRedirect(1, "?op=rudi&show=members&award={$member_id}");
        return;
    }
    $result = $db->Query("SELECT `date_added`, `record_note`, `member_id` FROM `rudi_service_record` WHERE `record_id` = '{$record_id}' LIMIT 1");
    $row = $db->FetchRow($result);
    echo "<a href=\"?op=rudi&show=members&award={$member_id}\">Cancel</a>";
    OpenTable();
    ?>
	
		<tr><td>Award:</td><td>
		<select name="award">
<?php 
    $awards = GetAllAwards();
    foreach ($awards as $award) {
        echo "<option value=\"{$award['award_id']}\">{$award['name']}</option>";
    }
    ?>
		</select>
		</td></tr>
		<tr><td>Date:</td><td><?php 
    $form->textField('date');
    ?>
</td></tr>
		<tr><td>Details:</td><td><?php 
    $form->textArea('details', 10, 30);
    ?>
</td></tr> 
		<tr><td colspan="2"><?php 
    $form->submitButton('processed', 'Add');
    ?>
</td></tr>
<?php 
    CloseTable();
    $form->__destruct();
}