Ver Mensaje Individual
  #5 (permalink)  
Antiguo 28/02/2010, 11:50
qazwsxedc
 
Fecha de Ingreso: febrero-2010
Mensajes: 41
Antigüedad: 14 años, 2 meses
Puntos: 0
Respuesta: como mandar mensajes con php - URGENTE

tengo un problema con esto que tengo y es que cuando envio el formulario no se me guarda ni los emails ni los comentarios en la tabla mensajes(esta tabla tiene mensajes,mail_p,mail_a).
por favor necesito ayuda URGENTEMENTE
graciassss

<?
session_cache_limiter('nocache,private');
session_start();

$enlace=mysql_connect("localhost","my","a");
$bd ="yo"; // Elección de la base de datos que se utilizará en el servidor
$bds = mysql_select_db($bd, $enlace); // seleccionar la bd
$alumno=$_SESSION['alumno'];
$pr=$_SESSION['profesor'];

$sql3 = "select * from alumnos where materia='$pr'";
$resultado3=mysql_query($sql3,$enlace);
while ($registro3=mysql_fetch_array($resultado3))
{
$mailp=$registro3['mail_p'];
}

$sql4 = "select * from profesores where materia='$alumno'";
$resultado4=mysql_query($sql4,$enlace);
while ($registro4=mysql_fetch_array($resultado4))
{
$maila=$registro4['mail_a'];
}


$sql5 = "select * from mensajes where mail_p='$mailp'";
$resultado5=mysql_query($sql5,$enlace);
while ($registro5=mysql_fetch_array($resultado5))
{
$mater=$registro5['materia'];
}


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Profesor</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>

<div class="historial">
<form id="guardar" method="post" action="http://www..../yo/insertarmensaje.php">
<p>MAIL ALUMNO</p></br>
<input id="not" type="text" name="mailalum" value="<? echo $maila; ?>"/>
<p>MAIL PROFESOR</p></br>
<input id="not" type="text" name="mailprof" value="<? echo $mailp; ?>"/>
<p>MATERIA</p>
<input id="not" type="text" name="mat" value="<? echo $mater; ?>"/>
<p>MENSAJE <? echo $mensajes; ?></p>
<textarea id="mensa" name="mensa" cols="55" rows="5"></textarea>
<input type="submit" name="enviar" value="Enviar" tabindex="7"/>
</form>

esto es a donde va el action del formulario anterior.

<?
session_cache_limiter('nocache,private');
session_start();
/* Datos de acceso para la conexión con el servidor MySQL */
$enlace=mysql_connect("localhost","my","a");
$bd ="yo"; // Elección de la base de datos que se utilizará en el servidor
$bds = mysql_select_db($bd, $enlace); // seleccionar la bd
$curso=$_SESSION['alumno'];
$pr=$_SESSION['profesor'];
$mail_a=$_POST['maila'];
$mail_p=$_POST['mailp'];
$materia=$_POST['mat'];
$mensajes=$_POST['mensa'];

mysql_query("insert into mensajes(mail_a,mail_p,materia,mensajes)values('$m ail_a,$mail_p,$materia,$mensajes)");
{
header('Location: http://www......php');
}
?>