very close to finishing my cms - got login to work trying to to the update script i can get it to pull the data in but not update
here is the code:
<?php
// Connect to the database
$cnx = mysql_connect("localhost", "*******", "*******")
OR die("Unable to connect to database!");
mysql_select_db("squarebar_db1", $cnx);
if ($_POST['submit_form'] == 1) {
// Save to the database
$data = mysql_real_escape_string(trim($_POST['fcktext']));
$res = mysql_query("UPDATE news SET data = '".$data."' WHERE id = $id");
if (!$res)
die("Error saving the record! Mysql said: ".mysql_error());
// Redirect to self to get rid of the POST
header("Location: select.php");
}
include_once "fckeditor/fckeditor.php";
?><!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" xml:lang="en" lang="en">
<head>
<title>Test FCKeditor</title>
</head>
<body>
<h1><font size="2" face="Arial, Helvetica, sans-serif"> FCK Editor</font></h1>
<form action="select.php" method="post">
<?php
// Get data from the database
$query = mysql_query("SELECT data FROM news WHERE id = $id");
$data = mysql_fetch_array($query);
// Configure and output editor
$oFCKeditor = new FCKeditor('fcktext');
$oFCKeditor->BasePath = "fckeditor/";
$oFCKeditor->Value = $data["data"];
$oFCKeditor->Width = 540;
$oFCKeditor->Height = 400;
echo $oFCKeditor->CreateHtml();
?>
<br />
<input type="hidden" name="submit_form" value="1" />
<input type="submit" value="Save Form" />
</form>
</body>
</html>
<?php
// Close the database connection
mysql_close($cnx);
?>
here is the code:
<?php
// Connect to the database
$cnx = mysql_connect("localhost", "*******", "*******")
OR die("Unable to connect to database!");
mysql_select_db("squarebar_db1", $cnx);
if ($_POST['submit_form'] == 1) {
// Save to the database
$data = mysql_real_escape_string(trim($_POST['fcktext']));
$res = mysql_query("UPDATE news SET data = '".$data."' WHERE id = $id");
if (!$res)
die("Error saving the record! Mysql said: ".mysql_error());
// Redirect to self to get rid of the POST
header("Location: select.php");
}
include_once "fckeditor/fckeditor.php";
?><!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" xml:lang="en" lang="en">
<head>
<title>Test FCKeditor</title>
</head>
<body>
<h1><font size="2" face="Arial, Helvetica, sans-serif"> FCK Editor</font></h1>
<form action="select.php" method="post">
<?php
// Get data from the database
$query = mysql_query("SELECT data FROM news WHERE id = $id");
$data = mysql_fetch_array($query);
// Configure and output editor
$oFCKeditor = new FCKeditor('fcktext');
$oFCKeditor->BasePath = "fckeditor/";
$oFCKeditor->Value = $data["data"];
$oFCKeditor->Width = 540;
$oFCKeditor->Height = 400;
echo $oFCKeditor->CreateHtml();
?>
<br />
<input type="hidden" name="submit_form" value="1" />
<input type="submit" value="Save Form" />
</form>
</body>
</html>
<?php
// Close the database connection
mysql_close($cnx);
?>