[Resolvido] Valor é apagado atomaticamete do banco de dados
Eu tenho um formulário de atulização e quando vou editar um formulario já inserido no banco de dados aparecem todos os campos preenchidos com os valores. So que quando vou editar o textarera do Ckeditor após eu enviar o formulário o valor desse campo é apagado atomaticamente do banco de dados e nada aparece, é como se nada fosse preenchido no campo textarea.
Código do formulário update:
<div id="wrap">
<h1>Formulário de atualização</h1>
<div id="CentralColumn">
<div id="articles">
<form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
<div>Conteúdo do site</div>
<div>
<?php
// Include CKEditor class.
include_once "../ckeditor/ckeditor.php";
// Include CKEditor class.
$valor = $row_RsPegarPaginaConteudos['pd_conteudo'];
// The initial value to be displayed in the editor.
$initialValue = "{$valor}";
// Create class instance.
$CKEditor = new CKEditor('pd_conteudo');
// Path to CKEditor directory, ideally instead of relative dir, use an absolute path:
// $CKEditor->basePath = '/ckeditor/'
// If not set, CKEditor will try to detect the correct path.
$CKEditor->basePath = '../ckeditor/';
// Create textarea element and attach CKEditor to it.
$CKEditor->editor("editor1", $initialValue);
?>
</div>
<div id="formregion">
<div id="theTitle">
<div class="formLabel">Título:</div>
<input name="pd_titulo" type="text" id="theMovieTitle" value="<?php echo $row_RsPegarPaginaConteudos['pd_titulo']; ?>" size="60" maxlength="80" />
<img src="../spry5/images/novas/ok.png" title="Valid" alt="Valid" class="validMsg" border="0"/>
<span class="textfieldRequiredMsg">É necessário um título.</span>
<span class="textfieldInvalidFormatMsg">Corrigir número de caractéres entre 60 e 80</span>
</div>
<div id="theDate">
<div class="formLabel">Descrição:</div>
<input name="pd_decricao" type="text" id="movieYear" value="<?php echo $row_RsPegarPaginaConteudos['pd_descricao']; ?>" size="80" maxlength="255" />
<img src="../spry5/images/novas/ok.png" title="Valid" alt="Valid" class="validMsg" border="0"/>
<span class="textfieldRequiredMsg">É necessário uma descrição.</span>
<span class="textfieldInvalidFormatMsg">Corrigir número de caractéres entre 80 e 255.</span>
</div>
<div id="theDuration">
<div class="formLabel">Palavras Chaves:</div>
<input name="pd_keywords" type="text" id="movieTime" value="<?php echo $row_RsPegarPaginaConteudos['pd_keywords']; ?>" size="50" maxlength="100"/>
<img src="../spry5/images/novas/ok.png" title="Valid" alt="Valid" class="validMsg" border="0"/>
<span class="textfieldRequiredMsg">É necessário palavras chaves.</span>
<span class="textfieldInvalidFormatMsg">Corrigir número de caractéres entre 50 e 100.</span>
</div>
<div id="theDescription">
<div class="formLabel">Conteúdo da Página:</div>
<table width="700" border="0">
<tr>
<td></td>
</tr>
</table>
</div>
<div class="buttons">
<input type="submit" name="Submit" id="submit" value="Atualizar"/>
<input name="pd_id" type="hidden" id="pd_id" value="<?php echo $row_RsPegarPaginaConteudos['pd_id']; ?>" />
<input name="pd_pn_id" type="hidden" id="pd_pn_id" value="<?php echo $row_RsPegarPaginaConteudos['pd_pn_id']; ?>" />
</div>
</div>
<input type="hidden" name="MM_update" value="form1" />
</form>
</div>
<div class="ClearAll"> </div>
</div>
</div>
Tódos codigos php e recorset:
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE ip_paginas_conteudos SET pc_pe_id=%s, pc_titulo=%s, pd_conteudo=%s, pc_descricao=%s, pc_keywords=%s WHERE pc_id=%s",
GetSQLValueString($_POST['pc_pe_id'], "int"),
GetSQLValueString($_POST['pc_titulo'], "text"),
GetSQLValueString($_POST['pc_conteudo'], "text"),
GetSQLValueString($_POST['pc_decricao'], "text"),
GetSQLValueString($_POST['pc_keywords'], "text"),
GetSQLValueString($_POST['pc_id'], "int"));
mysql_select_db($database_ip, $ip);
$Result1 = mysql_query($updateSQL, $ip) or die(mysql_error());
}
mysql_select_db($database_ip, $ip);
$query_RsPainelAdmin = "SELECT ma_label, ma_value FROM ip_menuadmin ORDER BY ma_label ASC";
$RsPainelAdmin = mysql_query($query_RsPainelAdmin, $ip) or die(mysql_error());
$row_RsPainelAdmin = mysql_fetch_assoc($RsPainelAdmin);
$totalRows_RsPainelAdmin = mysql_num_rows($RsPainelAdmin);
$colname_RsGetLista = "-1";
if (isset($_GET['conteudo'])) {
$colname_RsGetLista = $_GET['conteudo'];
}
mysql_select_db($database_ip, $ip);
$query_RsGetLista = sprintf("SELECT * FROM ip_paginas_conteudos WHERE pc_pe_id = %s", GetSQLValueString($colname_RsPegarLista, "int"));
$RsPegarLista = mysql_query($query_RsPegarLista, $ip) or die(mysql_error());
$row_RsPegarLista = mysql_fetch_assoc($RsPegarLista);
$totalRows_RsPegarLista = mysql_num_rows($RsPegarLista);
mysql_select_db($database_ip, $ip);
$query_RsListaNomePagina = "SELECT pe_id, pe_nome FROM ip_paginas_nome ORDER BY pe_nome ASC";
$RsListaNomePagina = mysql_query($query_RsListaNomePagina, $ip) or die(mysql_error());
$row_RsListaNomePagina = mysql_fetch_assoc($RsListaNomePagina);
$totalRows_RsListaNomePagina = mysql_num_rows($RsListaNomePagina);
$colname_RsPegarPaginaConteudos = "-1";
if (isset($_GET['conteudo'])) {
$colname_RsPegarPaginaConteudos = $_GET['conteudo'];
}
mysql_select_db($database_ip, $ip);
$query_RsPegarPaginaConteudos = sprintf("SELECT * FROM ip_paginas_conteudos WHERE pc_pe_id = %s", GetSQLValueString($colname_PegarPaginaConteudos, "int"));
$RsPegarPaginaConteudos = mysql_query($query_RsPegarPaginaConteudos, $ip) or die(mysql_error());
$row_RsPegarPaginaConteudos = mysql_fetch_assoc($RsPegarPaginaConteudos);
$totalRows_RsPegarPaginaConteudos = mysql_num_rows($RsPegarPaginaConteudos);
?>Discussão (10)
Carregando comentários...