SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Refresh issues

  1. #1
    SitePoint Member
    Join Date
    Apr 2011
    0 Post(s)
    0 Thread(s)

    Refresh issues

    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:

    $admin_root = "";
    $root = "../";

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">

    <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>

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

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


    #/ 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>";

    #/ End of defaultForm

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

    $message = "";


    $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;
    #/ 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);
    #/ End of Handling



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


    // 5. Close connection

  2. #2
    SitePoint Member thebuddy's Avatar
    Join Date
    Apr 2011
    0 Post(s)
    0 Thread(s)
    Try to use session_start();
    sometime it's useful

    Last edited by Mittineague; Apr 4, 2011 at 17:22. Reason: Please wait until you get your signature for your links.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts