davelf
04-13-2010, 06:54 AM
i 'm trying to make a website base php + CMS.
What i already do:
Basic php + CMS (add, delete, edit)
Problem:
1. This is my first time developing CMS
2. I want to use this text editor in my CMS:http://www.dynamicdrive.com/dynamicindex16/richtexteditor/index.htm
This is an example of my form
addnews:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Add News</title>
<script language="javascript">
function cekform(){
//ini untuk ngecek formnya (semua form tidak boleh kosong)
if(document.frmnews.txtsubject.value==""){
alert('Subject Must be Filled');
document.frmnews.txtsubject.focus();
return false;
}
else if(document.frmnews.txtcontent.value==""){
alert('Content Must be Filled');
document.frmnews.txtcontent.focus();
return false;
}
else {
return true;
}
}
</script>
</head>
<body bgcolor="#CCCCCC">
<div align="center">
<table width="800" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td colspan="2"><?php include "header.php";?></td>
</tr>
<tr>
<td width="160" valign="top"><?php include "menu.php";?> </td>
<td width="640" align="center" valign="top">
<p><br>
<!-- Content Here -->
</p>
<form action="" method="post" name="frmnews" onsubmit="return cekform()">
<table width="500px" border="1">
<tr>
<td>Subject </td>
<td><input name="txtsubject" type="text" id="txtsubject" /></td>
</tr>
<tr>
<td>Content</td>
<td><textarea name="txtcontent" id="txtcontent" rows="20" cols="50"></textarea></td>
</tr>
<tr>
<td> </td>
<td><input name="tblIsi" type="submit" id="tblIsi" value="add" /></td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td colspan="2"><?php include "footer.php";?></td>
</tr>
</table>
</div>
</body>
<?
include "connect.php";
if(isset($_POST['tblIsi'])){
$subject = $_POST['txtsubject'];
$date = date("d/m/y");
$content = $_POST['txtcontent'];
$sql="insert into news(subject,content,date) values('$subject','$content','$date')";
$kueri = mysql_query($sql);
if($kueri){
echo "<script>alert('News success insert to DB');document.location='news.php'</script>";
} else {
echo "<script>alert('News failed insert to DB')</script>";
echo mysql_error();
}
}
include("disconnect.php");
?>
This is my basic CMS form look like without text editor
http://www.dynamicdrive.com/forums/attachment.php?attachmentid=3240&stc=1&d=1271142227
thx in advanced for your attention...:)
What i already do:
Basic php + CMS (add, delete, edit)
Problem:
1. This is my first time developing CMS
2. I want to use this text editor in my CMS:http://www.dynamicdrive.com/dynamicindex16/richtexteditor/index.htm
This is an example of my form
addnews:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Add News</title>
<script language="javascript">
function cekform(){
//ini untuk ngecek formnya (semua form tidak boleh kosong)
if(document.frmnews.txtsubject.value==""){
alert('Subject Must be Filled');
document.frmnews.txtsubject.focus();
return false;
}
else if(document.frmnews.txtcontent.value==""){
alert('Content Must be Filled');
document.frmnews.txtcontent.focus();
return false;
}
else {
return true;
}
}
</script>
</head>
<body bgcolor="#CCCCCC">
<div align="center">
<table width="800" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td colspan="2"><?php include "header.php";?></td>
</tr>
<tr>
<td width="160" valign="top"><?php include "menu.php";?> </td>
<td width="640" align="center" valign="top">
<p><br>
<!-- Content Here -->
</p>
<form action="" method="post" name="frmnews" onsubmit="return cekform()">
<table width="500px" border="1">
<tr>
<td>Subject </td>
<td><input name="txtsubject" type="text" id="txtsubject" /></td>
</tr>
<tr>
<td>Content</td>
<td><textarea name="txtcontent" id="txtcontent" rows="20" cols="50"></textarea></td>
</tr>
<tr>
<td> </td>
<td><input name="tblIsi" type="submit" id="tblIsi" value="add" /></td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td colspan="2"><?php include "footer.php";?></td>
</tr>
</table>
</div>
</body>
<?
include "connect.php";
if(isset($_POST['tblIsi'])){
$subject = $_POST['txtsubject'];
$date = date("d/m/y");
$content = $_POST['txtcontent'];
$sql="insert into news(subject,content,date) values('$subject','$content','$date')";
$kueri = mysql_query($sql);
if($kueri){
echo "<script>alert('News success insert to DB');document.location='news.php'</script>";
} else {
echo "<script>alert('News failed insert to DB')</script>";
echo mysql_error();
}
}
include("disconnect.php");
?>
This is my basic CMS form look like without text editor
http://www.dynamicdrive.com/forums/attachment.php?attachmentid=3240&stc=1&d=1271142227
thx in advanced for your attention...:)