Preview: emailform_edit.php
Size: 7.88 KB
/home/jambtst2015/public_html/giraffeng.com/admin/emailform_edit.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;
}
$email_id = $_REQUEST['id'];
?>
<?php include("includes/header.php"); ?>
<?php
/*---For Add---*/
if(empty($_POST['submit'])){ $_POST['submit']=''; }
if($_POST['submit'] == 'Save'){
/*----check username----*/
$chksql = "select `id` from `sat_email_master` where `title`='".$_POST['title']."' and id != '".$email_id."' ";
$chkqry = mysql_query($chksql);
$getRow = mysql_num_rows($chkqry);
/*----end username check-*/
/*----check email----*/
$chksql_add = "select `id` from `sat_email_master` where `email_address`='".$_POST['email_address']."' and id != '".$email_id."'";
$chkqry_add = mysql_query($chksql_add);
$getRowadd = mysql_num_rows($chkqry_add);
/*----end username check-*/
if($getRow > 0){
$error = 'This Title already exists.';
}
elseif($getRowadd > 0){
$error = 'This Email Address already exists.';
}
else{
if($_POST['email_address'] == ''){
$error = 'Please enter Email Address.';
}
else{
$insSql = "update `sat_email_master` set ";
$insSql .= "email_address='".mysql_real_escape_string($_POST['email_address'])."', ";
$insSql .= "status='".$_POST['status']."', ";
$insSql .= "post_date=now() where id = '".$email_id."' ";
//echo $insSql;exit;
mysql_query($insSql);
//include("mailuser.php");
header('location:manage_email.php?success=1&page='.$_REQUEST['page'].'');
exit();
}
}
}
else{
$_POST['title']='';
$_POST['email_address']='';
$_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>
<?php
$sql_data = mysql_fetch_array(mysql_query("SELECT * FROM sat_email_master WHERE id = '".$email_id."'"));
?>
<td valign="top">
<div class="tbl-out">
<p class="client_table">
<i class="fa fa-edit"></i> Edit Email
</p>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="center-tbl new-tbl">
<tr>
<td align="right" valign="top" class="left_head_form">*Title</td>
<td>:</td>
<td class="title_head"><?php echo $sql_data['title']; ?> </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" class="left_head_form">*Email Address</td>
<td>:</td>
<td><input name="email_address" type="email_address" class="validate[required,custom[email]] textfield require_field" value="<?php echo $sql_data['email_address']; ?>"/></td>
</tr>
<tr>
<td align="right" valign="top" class="left_head_form">Status</td>
<td>:</td>
<td>
<select name="status" class="selectfield require_select">
<option value="Active" <?php if($sql_data['status']=='Active') { ?>selected="selected"<?php } ?>>Active</option>
<option value="Inactive" <?php if($sql_data['status']=='Inactive') { ?>selected="selected"<?php } ?>>Inactive</option>
</select>
</td>
</tr>
</table>
</div>
</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>
<td colspan="5" align="center">
<input name="submit" type="submit" value="Save" class="require org float-none" style=" margin-bottom:10px;" />
<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