<html>
<head>
<title>FCKeditor - Sample</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<link href="css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Edit Oppertunity</h1>
<div id="formArea">
<form action= "includes/update.php" method="post">
<?php
// Automatically calculates the editor base path based on the _samples directory.
// This is usefull only for these samples. A real application should use something like this:
// $oFCKeditor->BasePath = '/FCKeditor/' ; // '/FCKeditor/' is the default value.
$sBasePath = $_SERVER['PHP_SELF'];
$sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;
$oFCKeditor = new FCKeditor('name') ;
$oFCKeditor->BasePath = $sBasePath ;
require_once('includes/sql.php');
$oFCKeditor->Value = $copyOne ;
$oFCKeditor->Create() ;
?>
<br>
<input type="hidden" name="id" value="<?php echo $id; ?>">
<input type="hidden" name="tableName" value="<?php echo $tableName; ?>">
<input type="submit" value="Submit">
</form>
</div>
</body>
</html>
4.Now it's back to the includes folder for our update script which will post the changes to the sql file.
/*includes/update.php*/
<?php
require_once('connect.php');
if(isset($_POST)){
$copy= $_POST[name];
/*$copy= str_replace("'", "\'", $copy);*/
$id=$_POST[id];
$tableName=$_POST[tableName];
}
$sql="UPDATE $tableName SET copyOne ='$copy' WHERE id='$id'";
$result=$mysqli->query($sql);
if($result){
echo $copy;
} else {
echo mysqli_error($mysqli) . '<br>' . "\n";
echo $copy;
echo $tableName;
}
?>
RE: Use FCK with a database
<html> <head> <title>FCKeditor - Sample</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="robots" content="noindex, nofollow"> <link href="css/main.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>Edit Oppertunity</h1> <div id="formArea"> <form action= "includes/update.php" method="post"> <?php // Automatically calculates the editor base path based on the _samples directory. // This is usefull only for these samples. A real application should use something like this: // $oFCKeditor->BasePath = '/FCKeditor/' ; // '/FCKeditor/' is the default value. $sBasePath = $_SERVER['PHP_SELF']; $sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ; $oFCKeditor = new FCKeditor('name') ; $oFCKeditor->BasePath = $sBasePath ; require_once('includes/sql.php'); $oFCKeditor->Value = $copyOne ; $oFCKeditor->Create() ; ?> <br> <input type="hidden" name="id" value="<?php echo $id; ?>"> <input type="hidden" name="tableName" value="<?php echo $tableName; ?>"> <input type="submit" value="Submit"> </form> </div> </body> </html>4.Now it's back to the includes folder for our update script which will post the changes to the sql file. /*includes/update.php*/ <?php require_once('connect.php'); if(isset($_POST)){ $copy= $_POST[name]; /*$copy= str_replace("'", "\'", $copy);*/ $id=$_POST[id]; $tableName=$_POST[tableName]; } $sql="UPDATE $tableName SET copyOne ='$copy' WHERE id='$id'"; $result=$mysqli->query($sql); if($result){ echo $copy; } else { echo mysqli_error($mysqli) . '<br>' . "\n"; echo $copy; echo $tableName; } ?>