Preview: holidayform_07_01_15.php
Size: 8.74 KB
/home/jambtst2015/public_html/giraffeng.com/admin/holidayform_07_01_15.php
<?php include("includes/head.php");
//include("functions.php");
function change_dateformat_reverse_new($param)
{
$date=explode("/",$param);
$dateformat=$date[2]."-".$date[0]."-".$date[1];
return $dateformat;
}
?>
<?php include("includes/header.php"); ?>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function() {
$( "#holiday_date" ).datepicker();
});
</script>
<?php
/*---For Add---*/
if(empty($_POST['submit'])){ $_POST['submit']=''; }
if($_POST['submit'] == 'Save'){
/*----check username----*/
$chksql = "select `id` from `sat_holiday_master` where `holiday_name`='".$_POST['holiday_name']."' and `year` = '".$_POST['year']."'";
$chkqry = mysql_query($chksql);
$getRow = mysql_num_rows($chkqry);
/*----end username check-*/
/*----check email----*/
$chksql_date = "select `id` from `sat_holiday_master` where `holiday_date`='".$_POST['holiday_date']."' and `year` = '".$_POST['year']."'";
$chkqry_date = mysql_query($chksql_date);
$getRowdate = mysql_num_rows($chkqry_date);
/*----end username check-*/
if($getRow > 0){
$error = 'This Holiday Name already exists.';
}
elseif($getRowdate > 0){
$error = 'This Holiday Date already exists.';
}
else{
if($_POST['holiday_name'] == ''){
$error = 'Please enter Holiday Name.';
}
elseif($_POST['holiday_date'] == ''){
$error = 'Please enter Holiday Date.';
}
elseif($_POST['year'] == ''){
$error = 'Please enter Year.';
}
else{
$insSql = "insert into `sat_holiday_master` set ";
$insSql .= "holiday_name='".mysql_real_escape_string($_POST['holiday_name'])."', ";
$insSql .= "year='".mysql_real_escape_string($_POST['year'])."', ";
$insSql .= "holiday_date='".change_dateformat_reverse_new($_POST['holiday_date'])."', ";
$insSql .= "status='".$_POST['status']."', ";
$insSql .= "post_date=now() ";
//echo $insSql;exit;
mysql_query($insSql);
//include("mailuser.php");
header('location:holidays.php?success=1');
exit();
}
}
}
else{
$_POST['holiday_name']='';
$_POST['year']='';
$_POST['holiay_date']='';
$_POST['status']='';
}
/*---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>
<script type="text/javascript">
function setLevel(val){
document.getElementById('user_level_show').value = val;
document.getElementById('user_level').value = val;
}
function open_notes()
{
if(document.getElementById('notes').checked==true)
{
document.getElementById('notes_div').style.display='block';
}
if(document.getElementById('notes1').checked==true)
{
document.getElementById('notes_desc').value='';
document.getElementById('notes_div').style.display='none';
}
}
</script>
<script type="text/javascript">
function getkey(e)
{
if (window.event)
return window.event.keyCode;
else if (e)
return e.which;
else
return null;
}
function goodchars(e, goods)
{
var key, keychar;
key = getkey(e);
if (key == null) return true;
keychar = String.fromCharCode(key);
keychar = keychar.toLowerCase();
goods = goods.toLowerCase();
if (goods.indexOf(keychar) != -1)
return true;
if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
return true;
return false;
}
function setLevel(val){
document.getElementById('user_level_show').value = val;
document.getElementById('user_level').value = val;
}
function ChangeFocuszip(cur,nex)
{
var value=document.getElementById(cur).value;
if(value.length==5)
{
document.getElementById(nex).focus();
}
}
function ChangeFocus1(cur,nex)
{
var value=document.getElementById(cur).value;
if(value.length==3)
{
document.getElementById(nex).focus();
}
}
function ChangeFocus(cur,nex)
{
var value=document.getElementById(cur).value;
if(value.length==3)
{
document.getElementById(nex).focus();
}
}
function ChangeFocus1(cur,nex)
{
var value=document.getElementById(cur).value;
if(value.length==2)
{
document.getElementById(nex).focus();
}
}
</script>
<script type="text/javascript">
$(function(){
$('#username').keyup(function() {
//alert('Handler for .keyup() called.');
var val = $('#username').val();
$.ajax({
url : 'check.php',
type : 'POST',
data : 'val=' + val + '&type=username',
//dataType : 'json',
beforeSend : function(jqXHR, settings ){
//alert(1);
},
success : function( data, textStatus, jqXHR){
//alert(data);
$('#mailchk').show("slow");
$('#mail_view').html(data);
},
//complete : function( jqXHR, textStatus){
//alert(3);
//},
error : function( jqXHR, textStatus, errorThrown){
}
});
});
});
</script>
<div class="container_bottom_section tbl_cls_new">
<form name="formID" action="" method="post" id="formID">
<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 width="29%" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right" valign="top">*Year</td>
<td><?php /*?><input name="year" id="year" type="text" class="validate[required] textfield require_field" value="<?php echo $_POST['year']; ?>" /><?php */?>
<select name="year" id="year" class="validate[required] textfield require_field">
<option value="">--Select--</option>
<?php for($y=2015;$y<=2025;$y++)
{?>
<option value="<?php echo $y; ?>"<?php if($_REQUEST['year'] == $y) { ?> selected="selected" <?php } ?>><?php echo $y; ?></option>
<?php } ?>
</select>
</td>
</tr>
<tr id="mailchk" style="display:none;">
<td align="right" valign="top"> </td>
<td><div id="mail_view" style="padding:5px 0 7px 3px;"></div></td>
</tr>
<tr>
<td align="right" valign="top">*Holiday Name</td>
<td><input name="holiday_name" type="holiday_name" class="validate[required] textfield require_field" value="<?php echo $_POST['holiday_name']; ?>"/></td>
</tr>
<tr>
<td width="39%" align="right" valign="top">*Holiday Date</td>
<td width="61%"><input name="holiday_date" id="holiday_date" type="text" class="validate[required] textfield require_field" value="<?php echo $_POST['holiday_date']; ?>" /></td>
</tr>
<tr>
<td align="right" valign="top">Status</td>
<td><select name="status" class="selectfield require_select">
<option value="Active" <?php if($_POST['status']=='Active') { ?>selected="selected"<?php } ?>>Active</option>
<option value="Inactive" <?php if($_POST['status']=='Inactive') { ?>selected="selected"<?php } ?>>Inactive</option>
</select></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="2%" valign="top"> </td>
<td width="34%" valign="top"><table width="96%" border="0" cellspacing="0" cellpadding="0">
<tr>
</table>
</td>
</tr>
<tr>
<td colspan="5" align="center">
<input name="submit" type="submit" value="Save" class="submit" style=" margin-bottom:10px;" />
<input type="button" name="back" id="back" class="submit" value="Cancel" style=" margin-bottom:10px;" onclick="window.history.back();" />
</td>
</tr>
</table>
</form>
<div class="clear"></div>
</div>
<?php include("includes/footer.php"); ?>
Directory Contents
Dirs: 17 × Files: 180