0

Hi All,

I am a beginner in php and working on admin side of a small website. I have attached a PHP CKEDITOR to the admin page so that the admin may edit the pages text. Here, i am a bit confused about one thing and that is about how i can connect the CKEditor with mySQL database so that whatever text or HTML tags or images of CKEDITOR should be populated to the database.

Please help me to clear my concept!
Grateful to you for your time!
Thanks!
Bye.

5
Contributors
6
Replies
19
Views
6 Years
Discussion Span
Last Post by Qaalid
0

If you have a textarea with the name of "content", and replace that with an instance of a CKEditor, then when the form is submitted, there will be a $_POST item.

If you're instantiating the editor via PHP & not Javascript, then I'm sure there's a parameter somewhere to set the name of the field.

0

ok! Thanks for you reply and time!

What do you suggest, should i attach Javascript CKEDITOR and give it an instance name to get it to work!?

0

Well there is an officially supported PHP wrapper, so both/either should work. I think the site says that Javascript is the preferred method, but I think it's a matter of personal preference.

0

This is an example how to add it!!!Its my update page!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html
      xmlns="http://www.w3.org/1999/xhtml" 
      xml:lang="ro"
      lang="ro"> 
<head profile="http://www.w3.org/2005/10/profile"> 

<script src="ckeditor/_samples/sample.js" type="text/javascript"></script>
<link href="ckeditor/_samples/sample.css" rel="stylesheet" type="text/css" />

<style type="text/css">

strong {
font-family: Verdana;
font-size: 12px;
color: #000000;
}

.inputers {
background: #f8f8f8;
border: 1px solid #cccccc;
padding: 7px;
}

.submit {
border: 1px solid #777474;
-moz-border-radius: 3px;
background-image: url(imagini/button.png);
color: #56595a;
font-family: Verdana;
font-weight: bold;
padding: 5px;
width: 120px;
}

.submit:hover {
border: 1px solid #0c74aa;
-moz-border-radius: 3px;
background-image: url(imagini/button2.png);
color: #0d5b84;
font-family: Verdana;
font-weight: bold;
padding: 5px;
width: 120px;
}

a {
border: 1px solid #777474;
-moz-border-radius: 3px;
background-image: url(imagini/button.png);
color: #56595a;
font-family: Verdana;
text-decoration: none;
font-size: 14px;
font-weight: bold;
padding: 5px;
width: 120px;
}

a:hover {
border: 1px solid #0c74aa;
-moz-border-radius: 3px;
background-image: url(imagini/button2.png);
color: #0d5b84;
font-family: Verdana;
text-decoration: none;
font-size: 14px;
font-weight: bold;
padding: 5px;
width: 120px;
}


table {
background: #f3f3f3;
-moz-border-radius: 3px;
border: 1px solid #cccccc;
padding: 14px;
}
</style>


<script type="text/javascript" src="ckeditor/ckeditor.js"></script>

</head>
<body>

<?php 

include_once('db.php');

$q = mysql_query(" SELECT * FROM `forumtutorial_posts` WHERE `postid` = '".$_GET['postid']."' ");
while($v = mysql_fetch_assoc($q))
{
	$author= $v['author'];
	$title = $v['title'];
	$post  = $v['post'];
}

echo '
<table border=0 cellpadding=2 cellspacing=1>
<tr><th></th></tr>
<form action="myupdate.php" method="post" name="myform">
<tr><td width=120><strong>PostID</strong></td><td><input class=inputers type=text name=mpostid id=mpostid value="'.$_GET['postid'].'"/></td></tr>
<tr><td width=120><strong>Author</strong></td><td><input value="'.$author.'"  class=inputers type="text" name=author /></td></tr>
<tr><td width=120><strong>Title</strong></td><td><input value="'.$title.'" class=inputers type="text" name=title /></td></tr>
<tr><td width=120 valign=top><strong>Post</strong></td><td><textarea id="editor1" cols="80" rows="10" class="editor1 inputers" name="post" />'.$post.'</textarea>
			<script type="text/javascript">
			//<![CDATA[
				CKEDITOR.replace( "editor1" );
			//]]>
			</script>
</td></tr>
<tr><td height=60 colspan=2 align=right><a href="index.php">Cancel update</a> &nbsp; &nbsp; <input class=submit type=submit value=UPDATE /></td></tr>

</form>
</table>';
?>
</body>
</html>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.