View file File name : marketing-template-add.php Content :<?php session_start(); include("../include/config.php"); include("../include/functions.php"); include("../include/simpleimage.php"); validate_admin(); //echo "<pre>";print_r($_REQUEST);die; $template_title=mysqli_real_escape_string($GLOBALS['conn'],$_POST['template_title']); $email_subject=mysqli_real_escape_string($GLOBALS['conn'],$_POST['email_subject']); $email_content=mysqli_real_escape_string($GLOBALS['conn'],$_POST['email_content']); $template_type_id=mysqli_real_escape_string($GLOBALS['conn'],$_POST['template_type_id']); if($_REQUEST['submitForm']=='yes'){ if($_REQUEST['id']==''){ //$coupon_code=generateCouponCode(); $obj->query("insert into tbl_email_marketing_template set template_type_id='$template_type_id',template_title='$template_title', email_subject='$email_subject',email_content='$email_content',status=1"); $_SESSION['sess_msg']='Email Template added sucessfully'; }else{ $obj->query("update tbl_email_marketing_template set template_type_id='$template_type_id',template_title='$template_title', email_subject='$email_subject',email_content='$email_content',status=1 where id='".$_REQUEST['id']."'"); $_SESSION['sess_msg']='Email Template updated sucessfully'; } header("location:marketing-template-list.php"); exit(); } if($_REQUEST['id']!=''){ $sql=$obj->query("select * from tbl_email_marketing_template where id=".$_REQUEST['id']); $result=$obj->fetchNextObject($sql); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php echo SITE_TITLE; ?></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link href="css/admin.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" language="javascript"> </script> <style> .multiselect { width: 250px; height: inherit; } .selectBox { position: relative; } .selectBox select { width: 100%; font-weight: bold; } .overSelect { position: absolute; left: 0; right: 0; top: 0; bottom: 0; } #checkboxes { display: none; border: 1px #dadada solid; } #checkboxes label { display: block; } #checkboxes label:hover { background-color: #1e90ff; } </style> <link href="css/jquery.multiselect.css" rel="stylesheet" /> <script type="text/javascript" src="../include/ckeditor/ckeditor.js"></script> </head> <body> <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"> <?php include("header.php") ?> <link rel="stylesheet" href="calender/css/jquery-ui.css"> <script src="calender/js/jquery-ui.js"></script> <script> $(function() { $( "#expire_date" ).datepicker({ changeMonth: true, changeYear: true, dateFormat:"yy-mm-dd", yearRange:'2014:<?php echo date('Y')+5; ?>' }); }); </script> <tr> <td align="right" class="paddRtLt70" valign="top"> <table width="99%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="right" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="middle" class="headingbg bodr text14"> <em><img src="images/arrow2.gif" width="21" height="21" hspace="10" align="absmiddle" /></em>Admin: Add/Update Template <span style="float:right; padding-right:10px;"> <input type="button" name="add" value="View Template" class="button" onclick="location.href='marketing-template-list.php'" /></span></td> </tr> <tr> <td height="100" align="left" valign="top" bgcolor="#f3f4f6" class="bodr"> <form name="frm" method="POST" enctype="multipart/form-data" action="" onsubmit="return validate(this)"> <input type="hidden" name="submitForm" value="yes" /> <input type="hidden" name="id" value="<?php echo $_REQUEST['id'];?>" /> <table width="100%" cellpadding="0" cellspacing="0"> <tr> <td align="center" colspan="2" class="paddRt14 paddBot11"> <font color="#FF0000"><strong><?php echo $_SESSION['sess_msg']; $_SESSION['sess_msg']='';?></strong></font></td> </tr> <tr> <td width="18%" align="right" class="paddBot11 paddRt14"> </td> <td width="82%" align="left" class="paddBot11"></td> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong>Select Template For</strong></td> <td width="82%" align="left" class="paddBot11"> <select name="template_type_id" id="template_type_id" style="width:250px;" onchange="showByNotificationType(this.value);" > <option value="">Select Template For</option> <?php $sql=$obj->query("select * from tbl_email_marketing_type where status=1"); while($result2=$obj->fetchNextObject($sql)) {?> <option value="<?php echo $result2->id;?>" <?php if($result2->id==$result->template_type_id){?> selected <?php } ?>><?php echo $result2->name;?></option> <?php } ?> </select> </td> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong>Template Title :</strong></td> <td align="left" class="paddBot11"><input name="template_title" type="text" id="template_title" size="50" value="<?php echo stripslashes($result->template_title);?>" /></td> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong>  </strong></td> <td align="left" class="paddBot11"> <strong> Email Template Setting</strong> </td> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong>Email Subject :</strong></td> <td align="left" class="paddBot11"><input name="email_subject" type="text" id="email_subject" size="50" value="<?php echo stripslashes($result->email_subject);?>" /></td> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong>Email Body :</strong><br> Note: 1- Use {COUPON_CODE} to include coupon code in message text<br> Note: 2- Use {USER_NAME} to include User name in message text<br></td> <td align="left" class="paddBot11"><textarea name="email_content" rows="20" cols="80" class="ckeditor" id="email_content"><?php echo stripslashes($result->email_content);?></textarea></td> </tr> <tr> <td width="18%" align="right" class="paddRt14 paddBot11"> </td> <td width="82%" align="left" class="paddBot11"> <input type="submit" name="submit" value="Submit" class="submit" border="0"/> <input name="Reset" type="reset" id="Reset" value="Reset" class="submit" border="0" /></td> </tr> </table></form> </td> </tr> </table> </td> </tr> </table> </td> </tr> <?php include('footer.php'); ?> </table> </body> </html>