View file File name : content-addf.php Content :<?php session_start(); include("../include/config.php"); include("../include/functions.php"); validate_admin(); $content=mysqli_real_escape_string($GLOBALS['conn'],$_POST['content']); $title=mysqli_real_escape_string($GLOBALS['conn'],$_POST['title']); $meta_title=mysqli_real_escape_string($GLOBALS['conn'],$_POST['meta_title']); $meta_keywords=mysqli_real_escape_string($GLOBALS['conn'],$_POST['meta_keywords']); $meta_description=mysqli_real_escape_string($GLOBALS['conn'],$_POST['meta_description']); if($_REQUEST['submitForm']=='yes'){ if($_REQUEST['id']==''){ $obj->query("insert into $tbl_content set title='$title', content='".$content."' ,status=1,meta_title='$meta_title',meta_keywords='$meta_keywords',meta_description='$meta_description'"); $_SESSION['sess_msg']='Content added successfully'; }else{ $obj->query("update $tbl_content set content='".$content."',meta_title='$meta_title',meta_keywords='$meta_keywords',meta_description='$meta_description' where id=".$_REQUEST['id']); $_SESSION['sess_msg']='Content updated successfully'; } header("location:content-list.php"); exit(); } if($_REQUEST['id']!=''){ $sql=$obj->query("select * from $tbl_content 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=utf-8" /> <link href="css/admin.css" rel="stylesheet" type="text/css" /> <script src="../js/jquery-1.5.1.min.js"></script> <script type="text/javascript" language="javascript"> function validate(obj) { if(obj.title.value==''){ alert("Please enter title"); obj.title.focus(); return false; } } </script> <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") ?> <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: Update Content </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>Title :</strong></td> <td align="left" class="paddBot11"><?php if($_REQUEST['id']){ echo $result->title; } else {?><input name="title" type="text" id="title" size="36" value="<?php echo stripslashes($result->title);?>" /><?php } ?></td> </tr> <tr> <td align="right" class="paddRt14 paddBot11"><strong>Content :</strong></td> <td align="left" class="paddBot11"><textarea name="content" rows="20" cols="80" class="ckeditor" id="content"><?php echo stripslashes($result->content);?></textarea></td> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong>Meta Title:</strong></td> <td align="left" class="paddBot11"><textarea name="meta_title" rows="5" cols="40"><?php echo stripslashes($result->meta_title); ?></textarea></td> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong>Meta Keywords:</strong></td> <td align="left" class="paddBot11"><textarea name="meta_keywords" rows="5" cols="40"><?php echo stripslashes($result->meta_keywords); ?></textarea></td> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong>Meta Description:</strong></td> <td align="left" class="paddBot11"><textarea name="meta_description" rows="5" cols="40"><?php echo stripslashes($result->meta_description); ?></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>