I have the PHP FCKeditor within a form posting to a MySQL database. Both the editor and the connection are working, however when I hit submit, the data is not being saved.
You can try it out here:
http://66.118.157.72/editor/editor.php
Please take a look at the code below and tell me what I'm missing, thanks:
<?php require_once('../connections/fbf.php'); ?>
RE: PHP/MySQL: Problems posting input to data
The standard dreamweaver update recordset doesn't work with the editor. I had the same problem. The problem is the getthesqlvalue function; it just fubarrs the sql it generates and mysql doesn't understand it.
First, delete the getthesqlvalue function entirely. Be sure you get it all from the opening curly bracket to the last.
Then change this:
if ((isset($HTTP_POST_VARS["fbf_update"])) && ($HTTP_POST_VARS["fbf_update"] == "form1")) {
$updateSQL = sprintf("UPDATE que_content SET entry=%s WHERE id_number=%s",
GetSQLValueString($HTTP_POST_VARS['entry'], "text"),
GetSQLValueString($HTTP_POST_VARS['id_number'], "int"));
To this:
if ((isset($HTTP_POST_VARS["fbf_update"])) && ($HTTP_POST_VARS["fbf_update"] == "form1")) {
$entryVar = $HTTP_POST_VARS['entry'];
$idVar = $HTTP_POST_VARS['id_number'];
$updateSQL = "UPDATE que_content SET entry = '".$entryVar."' WHERE id_number = ".$idVar;
RE: PHP/MySQL: Problems posting input to data
Thanks for the help, meth. I tried your suggestion, and I'm still getting the same result of no data being posted to the database. I don't have to use the Dreamweaver cms syntax, I just need a php/mysql version that works with fckeditor.
Here's the latest version:
http://66.118.157.72/editor/editor2.php
Here's the code:
<?php require_once('../connections/fbf.php'); ?>
RE: PHP/MySQL: Problems posting input to data
I think I spotted the problem; you have instantiated the fckeditor as "form1";
$oFCKeditor = new FCKeditor('form1')
The editor will post the value of the edited content as $_POST ['form1'], same name as what you instantiate it. Instead you are grabbing the value from a different field;
$entryVar = $HTTP_POST_VARS['entry'];
This input value isn't even present in your form.
Your form also has the same name as your fck instance. Either change the form name and update:
<input type="hidden" name="fbf_update" value="form1">
to reflect this, or change the FCKeditor instance name, and edit your sql string & vars to reflect that change.
RE: PHP/MySQL: Problems posting input to data