Hi everyone!

I'm new around here, not sure if this is the right place to ask my question.

I have just designed my first CMS, all by myself, but I'm having some trouble. The thing is, after doing an edit, the admin won't automatically update the information, so it looks like it didn't really do the edit. It edits the content alright, the front-end does show the changes, but I can't get the back-end to automatically refresh. So far, I've only tried with <META HTTP-EQUIV="Pragma" CONTENT="no-cache">, which didn't help.

It happens with all the actions I have on my CMS (create, edit and delete). To give you an example, I'm going to use the simplest of the codes, and just take the example of a text edit function. Could you help me figure it out?

Thanks a lot!



The code is as follows:


<?php
$admin_root = "";
$root = "../";
require_once($root."includes/functions.php");
require_once($root."includes/connect.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">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<title>Administración: La empresa</title>
<link type="text/css" href="<?php echo $admin_root; ?>admin.css" rel="stylesheet" />

<script type="text/javascript" src="<?php echo $root;?>scripts/jquery-1.4.2.min.js" ></script>
<script type="text/javascript" src="<?php echo $root;?>scripts/jquery-ui-1.8.6.custom.min.js"></script>

<!-- //CKEditor -->
<script type="text/javascript" src="<?php echo $root;?>/scripts/ckeditor/ckeditor.js"></script>
</head>

<body>
<div id="container">
<?php include("includes/header.php"); //HEADER ?>

<div id="content" style="color:">

<?php

#/ Form to displayed
function defaultForm()
{

//get existing text
$empresa = get_datos_empresa();
$empresa_txt = mysql_fetch_array($empresa);
echo "<script type='text/javascript'> CKEDITOR.replace( 'empresa' );</script>";

global $empresa_txt;
echo "<form method=\"post\" enctype=\"multipart/form-data\" id='empresa_form'>\n";
echo "<h1>La empresa: </h1>";
echo "<textarea name='empresa' rows='10' cols='90' id='empresa'>".$empresa_txt['contenido']."</textarea>
";
echo "<input name=\"Submit\" type=\"submit\" value=\"Submit\">\n";
echo "<input name=\"filter\" type=\"hidden\" value=\"processForm\">\n"; ##/ hidden value points the switch to processing
echo "</form>";

echo "<script type='text/javascript'>
CKEDITOR.replace( 'empresa' );</script>";
return;

}
#/ End of defaultForm


##/ Function that displays forms and is called by default
function processForm() {
global $connection;
global $empresa_txt;

$message = "";

//RECEIVE VALUES

//empresa
$emp_contenido = mysql_prep($_POST['empresa']);

//UPLOAD VALUES: empresa
$query = "UPDATE empresa SET
contenido = '{$emp_contenido}'
WHERE tipo = 'empresa' ";
$result = mysql_query($query, $connection);
if (mysql_affected_rows() == 1) {
// Success
$message .= "It succeeded." ;
} elseif (!mysql_error() | mysql_error() == "") {
// No change was requested
$no = 1;
}
else {
// Failed
$message .= "The text could not be updated.";
$message .= "
". mysql_error();
}




if ($message == "") {$message = "No change was requested.";}
$message .= "
". "<a href='".$menu_root."edit_empresa.php'>Back</a>";

echo $message;
return;
}
#/ End of processForm


##/ This object handles which function the application should call
switch($_POST[filter]) {
case "processForm":
processForm($cat_cod, $cat_txt, $cat_type, $connection);
break;
default:
defaultForm($opciones_cat);
break;
}
#/ End of Handling

?>


</div>


<?php include("includes/footer.php"); ?>


</div>
</body>
</html>

<?php
// 5. Close connection
mysql_close($connection);