location.href = 'view_dep.php'"); } $grp = $_POST['gname']; if($grp == ''){ die(""); } $SQL = "SELECT * FROM group_title"; $result = mysql_query($SQL); while ($db_field = mysql_fetch_assoc($result)) { if ($grp == $db_field['group_name']){ $exist = true; break; } } if ($exist){ $msg = 'The Department is already exist!'; mysql_close($db_handle); } else{ //unwanted HTML (scripting attacks) $grp = htmlspecialchars($grp); //function $grp = quote_smart($grp, $db_handle); $SQL = "INSERT INTO group_title (`group_name`) VALUES ($grp)"; $result = mysql_query($SQL); if($result){ mysql_close($db_handle); $msg = 'The Department is successfully added.'; } else{ mysql_close($db_handle); $msg = "Error in adding the Department"; } } } ?> add_Departiments

DECOHAS Online Library System