This is the first time I've incorporated fck into a cms solution. A most infuriating scenario exists where, once the form containing the FCKeditor is submitted, the update sql will not execute, however the portion of the script containing the sql does run since the header() function properly redirects.
I've checked the posted values by submitting to a page which echos the POST array and sure enough, the POST values/names are all what they're supposed to be.
Thinking this may be some wierd DOM issue, I changed the form to submit to an independant script containing the update db sql. No dice.
I fail to see where this instance of the editor is going wrong; could one of you guys point in the right direction?
cms_content_pages.php :
n.b. gSQL() is a function to format the POST values before the sql string is constructed.
****UPDATE SQL****
if ((isset($_POST["Submit"])) && ($_POST["Submit"] == "Update_Content")) {
$updateSQL = sprintf("UPDATE table_editable_pages_content SET pageTitle=%s, pageLinkText=%s, pageContent=%s, lastEdited=%s WHERE pageID=%s",
gSQL($_POST['pg_title'], "text"),
gSQL($_POST['linkText'], "text"),
gSQL($_POST['pageID'], "int"),
gSQL($_POST['content'], "text"),
gSQL($_POST['lastEdited'], "date"));
mysql_select_db($database_conn_opFair, $conn_opFair);
$result = mysql_query($updateSQL, $conn_opFair) or die(mysql_error());
$goTo = "/admin/index_cms.php";
header('Location: '.$root.$goTo);
}
***FORM***
..snip..
<br>
</td>
</tr>
<tr class="trbtn">
</tr>
</table>
</form>
..snip..
I've checked the posted values by submitting to a page which echos the POST array and sure enough, the POST values/names are all what they're supposed to be.
Thinking this may be some wierd DOM issue, I changed the form to submit to an independant script containing the update db sql. No dice.
I fail to see where this instance of the editor is going wrong; could one of you guys point in the right direction?
cms_content_pages.php :
n.b. gSQL() is a function to format the POST values before the sql string is constructed.
****UPDATE SQL****
if ((isset($_POST["Submit"])) && ($_POST["Submit"] == "Update_Content")) {
$updateSQL = sprintf("UPDATE table_editable_pages_content SET pageTitle=%s, pageLinkText=%s, pageContent=%s, lastEdited=%s WHERE pageID=%s",
gSQL($_POST['pg_title'], "text"),
gSQL($_POST['linkText'], "text"),
gSQL($_POST['pageID'], "int"),
gSQL($_POST['content'], "text"),
gSQL($_POST['lastEdited'], "date"));
mysql_select_db($database_conn_opFair, $conn_opFair);
$result = mysql_query($updateSQL, $conn_opFair) or die(mysql_error());
$goTo = "/admin/index_cms.php";
header('Location: '.$root.$goTo);
}
***FORM***
..snip..
<?php $sBasePath = $_SERVER['PHP_SELF'] ; $oFCKeditor = new FCKeditor('content') ; $oFCKeditor->BasePath = 'fckEditor/' ; $oFCKeditor->Value = $row_rsUpdateContent['pageContent'] ; $oFCKeditor->Create() ; ?>
<br>
</td>
</tr>
<tr class="trbtn">
<td><input name="pageID" type="hidden" id="pageID" value="<?php echo $_GET['pageID']; ?>" />
<input name="lastEdited" type="hidden" id="lastEdited" value="<?php echo date("Y-m-d"); ?>" /></td><td> </td>
</tr>
</table>
</form>
..snip..
RE: fck + php, 'update' sql not executing
solution posted here:
https://sourceforge.net/forum/forum.php ... _id=257180