Preview: paper_year_set_add.php
Size: 7.69 KB
/home/jambtst2015/public_html/giraffeng.com/admin/paper_year_set_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'){
$add_year=date("Y");
$assign_year=$_POST['assign_year']."-06-16 00:05:12";
/*----check ----*/
$chksql_initial = "select * from `exam_paper` where `assign_year`='".$assign_year."' AND `paper_name`='".$_POST['paper_name']."' AND subject_id='".$_POST['subject_id']."'";
$chkqry_initial1 = mysql_query($chksql_initial);
$getRowinitial1 = mysql_num_rows($chkqry_initial1);
/*----*/
if($getRowinitial1 > 0){
$error = 'This paper already exists under this year.';
}
else{
$insSql="INSERT INTO `exam_paper` (`exam_board_id` ,`subject_id`,`paper_name`,`pass_marks`,`status`,`add_year`,`assign_year`)
VALUES (
'".$_POST['exam_board_id']."', '".$_POST['subject_id']."','".$_POST['paper_name']."','".$_POST['pass_marks']."','Active','".$add_year."','".$assign_year."');";
//echo $insSql;exit;
mysql_query($insSql);
//include("mailuser.php");
header('location:paper_year_set_list.php?success=1&page='.$_REQUEST['page'].'');
exit();
}
}
else{
$_POST['name']='';
}
/*---End Add---*/
?>
<script>
function showsubject(str) {
//alert(str);
if (str == "") {
document.getElementById("txtHint").innerHTML = "";
return;
} else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","getsubject.php?q="+str,true);
xmlhttp.send();
}
}
function showtopic(str) {
//alert(str);
if (str == "") {
document.getElementById("txtHint1").innerHTML = "";
return;
} else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("txtHint1").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","gettopic.php?q="+str,true);
xmlhttp.send();
}
}
function showsubtopic(str) {
//alert(str);
if (str == "") {
document.getElementById("txtHint2").innerHTML = "";
return;
} else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("txtHint2").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","getsubtopic.php?q="+str,true);
xmlhttp.send();
}
}
</script>
<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 Paper Set
</p>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="center-tbl new-tbl" style="width:55%;">
<tr>
<td align="right" valign="top">*Board</td>
<td><select name="exam_board_id" class="validate[required] selectfield require_select" onchange="showsubject(this.value)">
<option value="">--Select Board --</option>
<?php $board = mysql_query("select * from exam_board_master");
while($board_list=mysql_fetch_array($board))
{
?>
<option value="<?php echo $board_list['id']?>" <?php if($_POST['userclass']=='1') { ?>selected="selected"<?php } ?>><?php echo $board_list['name']?></option>
<?php } ?>
</select>
</td>
</tr>
<tr id="txtHint">
<td align="right" valign="top">*Subject</td>
<td><select name="subject_id" class="validate[required] selectfield require_select" onchange="showtopic(this.value)">
<option value="subject_id">--Select subject --</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['name']?></option>
<?php } ?>
</select>
</td>
</tr>
<tr>
<td align="right" valign="top" class="left_head_form">*Question Paper Name</td>
<td><input name="paper_name" type="title" class="validate[required] textfield require_field" value="<?php echo $sql_data['name']; ?>"/></td>
</tr>
<tr>
<td align="right" valign="top" class="left_head_form">*Year</td>
<td><input name="assign_year" type="title" class="validate[required] textfield require_field" value="<?php echo $sql_data['assign_year']; ?>"/>[e.g 2012]</td>
</tr>
<tr>
<td align="right" valign="top" class="left_head_form">*Pass Marks</td>
<td><input name="pass_marks" 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