Hola buenas tardes.
Resulta que e creado una pagina para editar el perfil de usuario y demás...
La primera parte me funciona fantasticamente:
He creado un formulario con los datos basicos y se actualizan sin problemas.
El problema viene cuando realizo otro formulario en la misma pagina que tb incluya otras caracteristicas del usuario.
Lo he hecho en la misma pagina utilizando tabs por eso he creado dos formularios....
Nada lo hago igual que el otro pero en este caso me voy a la web... he intento ver si funciona y me salta este error:

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\asfaces\forms\datos_basic.php:84) inC:\xampp\htdocs\asfaces\forms\descripcionform.php on line 52

y no se por que me esta ocurriendo esto...¿Alguien sabe que estoy haciendo mal?

0
Puntos
1410
Visitas
3
Resp
Por mavericka3 hace 10 años
Novice
Respuesta #1
hola, ese tipo de error ocurre cuando dejas saltos de linea en php, te explico.. revisa que en descripcionform.php no tengas algo como esto:
<?php 
?>
                   <------------ Este salto de linea te da error de header!!
<?php ?>
intenta dejarlo así:
<?php
                   <--------------Este salto de linea no da error de header!!
 ?>
0
Puntos
Por alber hace 10 años
Admin
Respuesta #2
Hola albert, te prometo que lo he mirado un monton de veces y no lo tengo de verdad mira este es el codigo:

<?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"] == "PresentacionForm")) {
$updateSQL = sprintf("UPDATE datosusers SET eslogan=%s, descripcion=%s WHERE id=%s",
GetSQLValueString($_POST['eslogan'], "text"),
GetSQLValueString($_POST['descripcion'], "text"),
GetSQLValueString($_POST['id'], "int"));

mysql_select_db($database_conexion, $conexion);
$Result1 = mysql_query($updateSQL, $conexion) or die(mysql_error());

$updateGoTo = "../usuarios/editar_perfil.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}

$varDatosInfoBasica_DatosInfoBasica = "0";
if (isset($_SESSION['MM_idusuario'])) {
$varDatosInfoBasica_DatosInfoBasica = $_SESSION['MM_idusuario'];
}
mysql_select_db($database_conexion, $conexion);
$query_DatosInfoBasica = sprintf("SELECT * FROM datosusers WHERE datosusers.id = %s", GetSQLValueString($varDatosInfoBasica_DatosInfoBasica, "int"));
$DatosInfoBasica = mysql_query($query_DatosInfoBasica, $conexion) or die(mysql_error());
$row_DatosInfoBasica = mysql_fetch_assoc($DatosInfoBasica);
$totalRows_DatosInfoBasica = mysql_num_rows($DatosInfoBasica);
?>
<form id="PresentacionForm" action="<?php echo $editFormAction ?>" name="PresentacionForm" method="POST">
<p class="eslogan">Elogan:</p>
<input name="eslogan" type="text" />
<p class="presentacion">Pequeña Presentación:</p>
<textarea name="descripcion"></textarea>
<input name="presentacionbutton" class="presentacionbutton" type="submit" value="Guardar" />
<input type="hidden" name="MM_update" value="PresentacionForm">
<input type="hidden" name="id" value="<?php echo $row_DatosInfoBasica['id']; ?>">
</form>
<?php
mysql_free_result($DatosInfoBasica);
?>
0
Puntos
Por mavericka3 hace 10 años
Novice
Respuesta #3
y el caso es que me voy a localhost y si que se me guarda en la base de datos pero no sale reflejado en la pagina solo los campos y este mensaje..
0
Puntos
Por mavericka3 hace 10 años
Novice
Para comentar Inicia sesión o Regístrate
Phpres 2025@ All rights reserved.
Utilizamos cookies para mejorar la navegación en el sitio. Más información Aceptar