Foros del Web » Programando para Internet » PHP »

Problema con envio de mensaje en php

Estas en el tema de Problema con envio de mensaje en php en el foro de PHP en Foros del Web. Tengo el siguiente codigo, que gestiona el envio y recibo de mensajes, a traves de php&mysql lo encontre en www.cesarcancino.com pero no entiendo porque no ...
  #1 (permalink)  
Antiguo 01/12/2011, 21:17
Avatar de cuervo699  
Fecha de Ingreso: febrero-2011
Mensajes: 104
Antigüedad: 13 años, 2 meses
Puntos: 7
Problema con envio de mensaje en php

Tengo el siguiente codigo, que gestiona el envio y recibo de mensajes, a traves de php&mysql lo encontre en www.cesarcancino.com pero no entiendo porque no me funciona la parte del input destinario y el input asunto...

lanza un error en la linea 96 y 100
no entiendo porq, aqui les dejo el zip con los archivos

Código PHP:
<?php 
session_start
();
include(
"conexion.php"); 

//redireccionar si no inicia sesion
if(!isset($_SESSION['usuario']))
{
    
header("Location: index.php");
}

//nuevo mensaje
if(isset($_POST['responder']))
{
    
    
//validar destinatario
    
$c_v_destinatario=mysql_query("select * from usuarios where usuario='".$_POST['destinatario']."'",$conexion)or die (mysql_error());
    if (
mysql_num_rows($c_v_destinatario)>0)
    {
        
          
mysql_query("insert into mensajes (
                                              asunto,
                                              mensaje,
                                              leido_autor,
                                              leido_destinatario,
                                              autor,
                                              destinatario,
                                              fecha,
                                              hora
                                              )values(
                                              
                                              '"
.$_POST['asunto']."',
                                              '"
.$_POST['mensaje']."',
                                              0,
                                              0,
                                              '"
.$_SESSION['usuario']."',
                                              '"
.$_POST['destinatario']."',
                                              now(),
                                              now()
                                              
                                              )"
,$conexion)or die (mysql_error());
                                              
$mensajes_exito="El mensaje ha sido enviado con &eacute;xito";
                                              
    }else{
        
$mensajes_error="El usuario no existe.";
    }
                                        
}

?>
<!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>Documento sin título</title>
<link href="estilos.css" rel="stylesheet" type="text/css" />
</head>

<body onload="focux();">
<?php include("cabecera.php"); ?>
<?php 
include("barra.php"); ?>
<?php 
include("mensajes_error.php"); ?>
<div id="cuerpo">
  <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td align="center">&nbsp;</td>
    </tr>
    <tr>
      <td>

      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="50" align="center" valign="middle" bgcolor="#D7D7FF"><strong>&nbsp;&nbsp;NUEVO MENSAJE</strong></td>
          </tr>
        
        <tr>
          <td align="center">&nbsp;</td>
        </tr>
          
      </table>
      

      
      
      </td>
    </tr>
    <tr>
      <td align="center">&nbsp;</td>
    </tr>
    <tr>
      <td align="center">
      <form id="form1" name="form1" method="post" action="">
        <label for="destinatario"></label>
        <table border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td>Para</td>
            <td><input name="destinatario" type="text" id="destinatario" size="60" value="<?php echo $_POST['destinatario']; ?>" /></td>
          </tr>
          <tr>
            <td>Asunto</td>
            <td><input name="asunto" type="text" id="asunto" size="60" value="<?php echo $_POST['asunto']; ?>" />
              </td>
          </tr>
          <tr>
            <td colspan="2" align="center"><textarea  name="mensaje" id="mensaje" cols="100" rows="15"><?php if(isset($_POST['mensaje'])){echo $_POST['mensaje'];} ?></textarea></td>
            </tr>
          <tr>
            <td colspan="2" align="center"><input type="submit" name="responder" id="responder" value="Enviar" /></td>
          </tr>
        </table>
        &nbsp;<br />
        <label for="asunto"></label>
        <br />
        <br />
      </form></td>
    </tr>
  </table>
  
  
  
  
</div>

<?php include("pie.php"); ?>
</body>
</html>
ZIP: http://pixeluno.com.ar/mansajeria_ce...a/mensajes.rar
http://www.cesarcancino.com/ejercici...-poo-n174.html

Porfavor ayudenme, alfin encontre un sistema de mensajeria con php&mysql y me aparece este error :( se q ustedes son secos, HELP ME!
__________________
Quieres aprender a crear sitios web dinamicos, no te pierdas, usa Dreamweaver CS5
  #2 (permalink)  
Antiguo 01/12/2011, 21:49
 
Fecha de Ingreso: abril-2009
Mensajes: 46
Antigüedad: 15 años
Puntos: 1
Respuesta: Problema con envio de mensaje en php

que tienes en las líneas 96 y 100 ? que dice el error?
Ayudanos a ayudarte.
  #3 (permalink)  
Antiguo 01/12/2011, 22:29
Avatar de cuervo699  
Fecha de Ingreso: febrero-2011
Mensajes: 104
Antigüedad: 13 años, 2 meses
Puntos: 7
Respuesta: Problema con envio de mensaje en php

jjejjeje ok! emm...
dice:

Notice: Undefined index: asunto in C:\wamp\www\mensajes\nuevo.php on line 96
Notice: Undefined index: asunto in C:\wamp\www\mensajes\nuevo.php on line 100

Linea 96 <td><input name="destinatario" type="text" id="destinatario" size="60" value="<?php echo $_POST['destinatario']; ?>" /></td>
</tr>
<tr>
<td>Asunto</td>
Linea 100 <td><input name="asunto" type="text" id="asunto" size="60" value="<?php echo $_POST['asunto']; ?>" />

Aqui dejo una imagen, para ayudarlos a ayudarme xD

http://www.subirimagenes.com/imagen-...a-7198916.html
__________________
Quieres aprender a crear sitios web dinamicos, no te pierdas, usa Dreamweaver CS5
  #4 (permalink)  
Antiguo 01/12/2011, 22:31
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: Problema con envio de mensaje en php

Ese tipo de errores se comentan aquí:
http://www.forosdelweb.com/f18/undef...riable-923992/
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #5 (permalink)  
Antiguo 01/12/2011, 22:37
Avatar de cuervo699  
Fecha de Ingreso: febrero-2011
Mensajes: 104
Antigüedad: 13 años, 2 meses
Puntos: 7
Respuesta: Problema con envio de mensaje en php

[QUOTE=cuervo699;4058137]jjejjeje ok! emm...
dice:

Notice: Undefined index: asunto in C:\wamp\www\mensajes\nuevo.php on line 96
Notice: Undefined index: asunto in C:\wamp\www\mensajes\nuevo.php on line 100

Linea 96 <td><input name="destinatario" type="text" id="destinatario" size="60" value="<?php echo $_POST['destinatario']; ?>" /></td>
</tr>
<tr>
<td>Asunto</td>
Linea 100 <td><input name="asunto" type="text" id="asunto" size="60" value="<?php echo $_POST['asunto']; ?>" />

Aqui dejo una imagen, para ayudarlos a ayudarme xD

__________________
Quieres aprender a crear sitios web dinamicos, no te pierdas, usa Dreamweaver CS5
  #6 (permalink)  
Antiguo 01/12/2011, 22:43
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: Problema con envio de mensaje en php

Por favor, no repitas lo mismo y lee el enlace que te deje, ahí se explica el error y las posibles soluciones.
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.

Etiquetas: html, mensaje, mysql, sql, usuarios
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 22:10.