Preview: topic_add.php
Size: 3.79 KB
/home/jambtst2015/public_html/giraffeng.com/admin/topic_add.php
<?php include("includes/head.php"); ?>
<?php include("includes/header.php"); ?>
<?php
/*------------For Add-----------------*/
//$exam_board_id = $_REQUEST['id'];
if(empty($_POST['submit'])){ $_POST['submit']=''; }
if($_POST['submit'] == 'Save'){
/*----check ----*/
$chksql_initial = "select * from `exam_topic` where `subject_id`='".$_POST['subject_id']."' AND `name`='".$_POST['name']."'";
$chkqry_initial = mysql_query($chksql_initial);
$getRowinitial = mysql_num_rows($chkqry_initial);
/*----*/
if($getRow > 0){
$error = 'Topic already exists';
}
else{
$insSql="INSERT INTO `exam_topic` (`subject_id` ,`name`)
VALUES (
'".$_POST['subject_id']."', '".$_POST['name']."');";
//echo $insSql;exit;
mysql_query($insSql);
//include("mailuser.php");
header('location:topiclist.php?success=1&page='.$_REQUEST['page'].'');
exit();
}
}
/*---End Add---*/
?>
<script>
function formSub(){
//alert(11111111);
document.formID.submit();
return true;
}
jQuery.noConflict();
(function($) {jQuery(document).ready(function(){
// binds form submission and fields to the validation engine
jQuery("#formID").validationEngine('attach', {
onValidationComplete: function(form, status){
//alert("The form status is: " +status+", it will never submit");
if(status == true){
//$('input[type="submit"]').attr('disabled','disabled');
return formSub();
}
}
});
});})(jQuery);
</script>
<div class="container_bottom_section tbl_cls_new">
<form name="formID" action="" method="post" id="formID" enctype="multipart/form-data">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?php if(empty($error)){$error='';}
if($error!=''){
?>
<tr>
<td colspan="5">
<div class="error"><?php echo $error; ?></div>
</td>
</tr>
<?php } ?>
<tr>
<td valign="top">
<div class="tbl-out">
<p class="client_table">
<i class="fa fa-edit"></i> Add
</p>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="center-tbl new-tbl">
<tr>
<td align="right" valign="top">*Subject</td>
<td><select name="subject_id" class="validate[required] selectfield require_select">
<option value="">--Select Subject Name --</option>
<?php $subject = mysql_query("select * from exam_subject_master");
while($subject_list = mysql_fetch_array($subject))
{
?>
<option value="<?php echo $subject_list['id']?>" <?php if($_POST['userclass']=='1') { ?>selected="selected"<?php } ?>><?php echo $subject_list['subject']?></option>
<?php } ?>
</select>
</td>
</tr>
<tr>
<td align="right" valign="top" class="left_head_form">*Topic</td>
<td><input name="name" type="title" class="validate[required] textfield require_field" value="<?php echo $sql_data['name']; ?>"/></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
<td width="2%" valign="top"> </td>
<td width="34%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="5" align="center">
<input name="submit" type="submit" value="Save" class="require float-none org" style=" margin-bottom:10px;" onclick="return Checkfiles();" />
<input type="button" name="back" id="back" class="require float-none" value="Cancel" style=" margin-bottom:10px;" onclick="window.history.back();" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<div class="clear"></div>
</div>
<?php include("includes/footer.php"); ?>
Directory Contents
Dirs: 17 × Files: 180