estou tentando atualizar´/inserir dados em form, e apos isso redirecionar o usuario para outra pagina, para isso estou usando RecordsSets do Dreamweaver,(tentando agilizar acabo q atrasou todo o projeto) enfim, configurei o RecordSets para que depois da atualização fosse para outra pagina e não esta indo de jeito nenhum já fiz de quase tudo. o erro na pagina é esse.Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\measure\admin\menu2.php:67) in C:\wamp\www\measure\admin\conteudo_noticia.php on line 63
OBS 1: o conteudo esta sendo inserido e atualizado normalmente no banco de dados.
OBS 3: Desculpem por postar o codigo todo, fica ate dificil de ler, mas não tenho ideia de onde esteja o erro. :(
OBS 2: como se vê no codigo tentei usar o ob_start(); como já vi resolver esse tipo de problema em outros lugares.
Pergunta
igor Br22
Galera,
estou tentando atualizar´/inserir dados em form, e apos isso redirecionar o usuario para outra pagina, para isso estou usando RecordsSets do Dreamweaver,(tentando agilizar acabo q atrasou todo o projeto) enfim, configurei o RecordSets para que depois da atualização fosse para outra pagina e não esta indo de jeito nenhum já fiz de quase tudo. o erro na pagina é esse.Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\measure\admin\menu2.php:67) in C:\wamp\www\measure\admin\conteudo_noticia.php on line 63
OBS 1: o conteudo esta sendo inserido e atualizado normalmente no banco de dados.
OBS 3: Desculpem por postar o codigo todo, fica ate dificil de ler, mas não tenho ideia de onde esteja o erro. :(
OBS 2: como se vê no codigo tentei usar o ob_start(); como já vi resolver esse tipo de problema em outros lugares.
<?php ob_start(); $acao = $_GET["acao"]; $id = $_GET["id"]; ?> <?php require_once('../Connections/measure.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $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 pg_detalhe SET pd_titulo=%s, pd_conteudo=%s, pd_descricao=%s, pd_keywords=%s, pd_status=%s WHERE pd_id=%s", GetSQLValueString($_POST['pd_titulo'], "text"), GetSQLValueString($_POST['pd_conteudo'], "text"), GetSQLValueString($_POST['pd_descricao'], "text"), GetSQLValueString($_POST['pd_keywords'], "text"), GetSQLValueString($_POST['pd_status'], "text"), GetSQLValueString($_POST['pd_id'], "int")); mysql_select_db($database_measure, $measure); $Result1 = mysql_query($updateSQL, $measure) or die(mysql_error()); $updateGoTo = "principal.php?link=2&atualizado=ok"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header("Location: %s", $updateGoTo); } $colname_RsGetNoticia = "-1"; if (isset($_GET['acao'])) { $colname_RsGetNoticia = $_GET['acao']; } mysql_select_db($database_measure, $measure); $query_RsGetNoticia = sprintf("SELECT * FROM pg_detalhe WHERE pd_id = $id", GetSQLValueString($colname_RsGetNoticia, "int")); $RsGetNoticia = mysql_query($query_RsGetNoticia, $measure) or die(mysql_error()); $row_RsGetNoticia = mysql_fetch_assoc($RsGetNoticia); $totalRows_RsGetNoticia = mysql_num_rows($RsGetNoticia); mysql_select_db($database_measure, $measure); $query_RsListaNoticias = "SELECT * FROM pg_detalhe WHERE pd_id = '$id' ORDER BY pd_data ASC"; $RsListaNoticias = mysql_query($query_RsListaNoticias, $measure) or die(mysql_error()); $row_RsListaNoticias = mysql_fetch_assoc($RsListaNoticias); $totalRows_RsListaNoticias = mysql_num_rows($RsListaNoticias); mysql_select_db($database_measure, $measure); $query_RsUpdate = "SELECT * FROM pg_detalhe"; $RsUpdate = mysql_query($query_RsUpdate, $measure) or die(mysql_error()); $row_RsUpdate = mysql_fetch_assoc($RsUpdate); $totalRows_RsUpdate = mysql_num_rows($RsUpdate); ?> <!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" /> <title>Untitled Document</title> <script src="../spry/widgets/textfieldvalidation/SpryValidationTextField.js" type="text/javascript"></script> <link href="../spry/widgets/textfieldvalidation/SpryValidationTextField.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="../spry/samples/validationwidgets/with_spry_region/validation.css" media="all"> <!-- JAVA SCRIPT PARA EDITOR ONLINE --> <script type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script> <script type="text/javascript"> <!-- tinyMCE.init({ // General options mode : "textareas", theme : "advanced", plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager", // Theme options theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : true, // Example content CSS (should be your site CSS) content_css : "css/example.css", // Drop lists for link/image/media/template dialogs template_external_list_url : "js/template_list.js", external_link_list_url : "js/link_list.js", external_image_list_url : "js/image_list.js", media_external_list_url : "js/media_list.js", // Replace values for the template plugin template_replace_values : { username : "Some User", staffid : "991234" } }); function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } //--> </script> <style type="text/css"> <!-- .style3 {color: #0000FF} --> </style> <style type="text/css"> <!-- .style5 {color: #000000} a { font-size: 14px; color: #0000FF; } a:active { color: #F0F0F0; } --> </style> </head> <body> <table width="100%"> <tr> <td bgcolor="#CCCCCC"><h4 align="center"> </h4> <h2 align="center" class="style5 style3">Inserindo/Atualizando conteúdo na página (<span class="style3"> <?php if ($id == $row_RsListaNoticias['pd_id']) { echo $row_RsListaNoticias['pd_nome']; } ?> </span>)</h2></td> </tr> <tr> <td><form action="<?php echo $editFormAction; ?>" method="post" name="form1" > <table align="center"> <tr valign="baseline"> <td align="right" nowrap="nowrap" bgcolor="#CCCCCC">Titulo:</td> <td bgcolor="#FFFF99"><input type="text" name="pd_titulo" value="<?php echo htmlentities($row_RsGetNoticia['pd_titulo'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td> </tr> <tr valign="baseline"> <td align="right" valign="top" nowrap="nowrap" bgcolor="#CCCCCC">Conteudo da notícia</td> <td height="180" bgcolor="#FFFF99"><textarea name="pd_conteudo" cols="50" rows="5"><?php echo htmlentities($row_RsGetNoticia['pd_conteudo'], ENT_COMPAT, 'utf-8'); ?></textarea> </td> </tr> <tr valign="baseline"> <td align="right" nowrap="nowrap" bgcolor="#CCCCCC">Descrição</td> <td bgcolor="#FFFF99"><input type="text" name="pd_descricao" value="<?php echo htmlentities($row_RsGetNoticia['pd_descricao'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td> </tr> <tr valign="baseline"> <td align="right" nowrap="nowrap" bgcolor="#CCCCCC">Palavras Chave:</td> <td bgcolor="#FFFF99"><input type="text" name="pd_keywords" value="<?php echo htmlentities($row_RsGetNoticia['pd_keywords'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td> </tr> <tr valign="baseline"> <td align="right" nowrap="nowrap" bgcolor="#CCCCCC">Status:</td> <td bgcolor="#FFFF99"><select name="pd_status"> <option value="1" <?php if (!(strcmp(1, htmlentities($row_RsGetNoticia['pd_status'], ENT_COMPAT, 'utf-8')))) {echo "SELECTED";} ?>>OnLine</option> <option value="0" <?php if (!(strcmp(0, htmlentities($row_RsGetNoticia['pd_status'], ENT_COMPAT, 'utf-8')))) {echo "SELECTED";} ?>>OffLine</option> </select> </td> </tr> <tr valign="baseline"> <td align="right" nowrap="nowrap" bgcolor="#CCCCCC"> </td> <td bgcolor="#FFFF99"><input type="submit" value="Inserir/Modificar" /></td> </tr> </table> <input type="hidden" name="MM_update" value="form1" /> <input type="hidden" name="pd_id" value="<?php echo $row_RsGetNoticia['pd_id']; ?>" /> </form> <p> </p></td> </tr> <tr> <td> </td> </tr> </table> <span class="style5 style3"><span class="style3"> </span></span> <script type="text/javascript"> <!-- var keywords = new Spry.Widget.ValidationTextField("keywords", 'none', {useChracterMasking:true, regExpFilter:/^[^\'"\*]{0,15}$/, validateOn:["change"]}); var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", 'none', {useChracterMasking:true, regExpFilter:/^[^\'"\*]{0,15}$/, validateOn:["change"]}); var date1 = new Spry.Widget.ValidationTextField("date1", 'none', {useChracterMasking:true, regExpFilter:/^[^\'"\*]{0,15}$/, validateOn:["change"]}); //--> </script> </body> </html> <?php mysql_free_result($RsGetNoticia); mysql_free_result($RsListaNoticias); mysql_free_result($RsUpdate); ?>Link para o comentário
Compartilhar em outros sites
9 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.