2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2006 by Greg Gay & Joel Kronenberg */
6 /* Adaptive Technology Resource Centre / University of Toronto */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License */
11 /* as published by the Free Software Foundation. */
12 /****************************************************************/
14 define('AT_INCLUDE_PATH', '../include/');
15 require (AT_INCLUDE_PATH.'vitals.inc.php');
17 authenticate(AT_PRIV_FAQ);
19 if (isset($_POST['cancel'])) {
20 $msg->addFeedback('CANCELLED');
21 header('Location: index_instructor.php');
23 } else if (isset($_POST['submit'])) {
24 if (trim($_POST['name']) == '') {
25 $msg->addError('NAME_EMPTY');
28 if (!$msg->containsErrors()) {
29 $_POST['name'] = $addslashes($_POST['name']);
31 $sql = "INSERT INTO ".TABLE_PREFIX."faq_topics VALUES (NULL, $_SESSION[course_id], '$_POST[name]')";
32 $result = mysql_query($sql,$db);
34 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
35 header('Location: index_instructor.php');
40 $onload = 'document.form.name.focus();';
42 require(AT_INCLUDE_PATH.'header.inc.php');
46 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form">
48 <div class="input-form">
50 <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><label for="name"><?php echo _AT('name'); ?></label><br />
51 <input type="text" name="name" size="50" id="name" value="<?php if (isset($_POST['name'])) echo $stripslashes($_POST['name']); ?>" />
54 <div class="row buttons">
55 <input type="submit" name="submit" value="<?php echo _AT('save'); ?>" accesskey="s" />
56 <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
61 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>