2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
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']);
30 //This will truncate the content of the length to 240 as defined in the db.
31 $_POST['name'] = validate_length($_POST['name'], 250);
33 $sql = "INSERT INTO ".TABLE_PREFIX."faq_topics VALUES (NULL, $_SESSION[course_id], '$_POST[name]')";
34 $result = mysql_query($sql,$db);
36 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
37 header('Location: index_instructor.php');
42 $onload = 'document.form.name.focus();';
44 require(AT_INCLUDE_PATH.'header.inc.php');
47 $savant->display('instructor/faq/add_topic.tmpl.php');
48 require(AT_INCLUDE_PATH.'footer.inc.php'); ?>