hi everyone!
i´m sorry my mistakes in type, because i´m from portugal.
My question is:
I want to work with multipages in FCKeditor, but i only have a variable to one page "a".
How can i put more pages in Database, to create a basic website with multipages
I expect your answer thanks for atention
Pedro
this is my database:
fck_data` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`data` TEXT NOT NULL
) ENGINE = MYISAM ;
my index file with the editor:
? include'/class/login.class.php'; include '/class/ver_sessao.class.php'; if ($_GET['logout'] == "sair") {session_start(); $_SESSION = array(); session_destroy(); header("location:login.php"); } ?> <? require('../includes/admin/auth.inc'); ?> <?php // Connect to the database $cnx = mysql_connect("localhost", "root", "pedro") OR die("Unable to connect to database!"); mysql_select_db("info", $cnx); if ($_POST['submit_form'] == 1) { // Save to the database $data = mysql_real_escape_string(trim($_POST['fcktext'])); $res = mysql_query("UPDATE fck_data SET data = '".$data."' WHERE id = 1"); if (!$res) die("Error saving the record! Mysql said: ".mysql_error()); // Redirect to self to get rid of the POST header("Location: index.php"); } include_once "../includes/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> <table align="center" height="100" width="200"> <tr> <td align="center" width="20"> <a href="index.php?filename=a" >a</a> </td> <td align="center" width="20"> <a href="index.php?filename=b" >b</a> </td> <td align="center" width="20"> <a href="index.php?filename=c" >c</a> </td> </tr> </table> <?php switch($_GET['filename']) { case a: include'a.php'; break; case b: include'b.php'; break; case c: include'c.php'; break; default: $_GET['data'] = "a.php"; } ?> <h1>Test FCKeditor</h1> <form action="index.php" method="post"> <?php // Get data from the database $query = mysql_query("SELECT data FROM fck_data WHERE id = 1"); $data = mysql_fetch_array($query); // Configure and output editor $oFCKeditor = new FCKeditor('fcktext'); $oFCKeditor->BasePath = "../includes/FCKeditor/"; $oFCKeditor->Value = $data["data"]; $oFCKeditor->Width = 1200; $oFCKeditor->Height = 600; 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); ?>
my a.php file
<?php function nukeMagicQuotes() { if (get_magic_quotes_gpc()) { function stripslashes_deep($value) { $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); return $value; } $_POST = array_map('stripslashes_deep', $_POST); $_GET = array_map('stripslashes_deep', $_GET); $_COOKIE = array_map('stripslashes_deep', $_COOKIE); } } ?> <?php nukeMagicQuotes(); ?> <?php // Connect to the database $cnx = mysql_connect("localhost", "root", "pedro"); if (!$cnx) { die("Unable to connect to database!"); } // Select your database mysql_select_db("info", $cnx); // Get data from the database $query = mysql_query("SELECT data FROM fck_data WHERE id = 1"); $data = mysql_fetch_array($query); ?> <!-- This is where the content from your database is displayed we are telling the database to display the content from the field in the database called data --> <table height="100"> <tr> <td> </td> </tr> </table> <table align="center" height="300" width="800"> <tr> <td> <div> <?php echo $data[data]; ?> </div> </td> </tr> </table>
Thanks!