Foros del Web » Programando para Internet » PHP »

Notice: Undefined index: email in C:\wamp\www\mail.php on line 5

Estas en el tema de Notice: Undefined index: email in C:\wamp\www\mail.php on line 5 en el foro de PHP en Foros del Web. LLEGO AQUÍ CON ESPERANZA... de que alguien me ayude... POR FAVOR!!! Cuento corto: es la primera vez que intento hacer funcionar un formulario creado en ...
  #1 (permalink)  
Antiguo 07/05/2010, 17:51
 
Fecha de Ingreso: mayo-2010
Mensajes: 7
Antigüedad: 14 años
Puntos: 0
Exclamación Notice: Undefined index: email in C:\wamp\www\mail.php on line 5

LLEGO AQUÍ CON ESPERANZA... de que alguien me ayude... POR FAVOR!!!

Cuento corto: es la primera vez que intento hacer funcionar un formulario creado en DW, con el correspondiente .php asociado, que se transforma en un nuevo .html dentro de mi página como respuesta. PERO NO LO LOGRO...

Les paso el código que la "teacher" del curso de DW nos facilitó para hipotéticamente hacer que las cosas nos funcionen...

(perdón que vaya con las anotaciones... pero así, de paso, ven lo que me dijeron...)

<!-- TODO LO QUE ESTA ACA ES CODIGO PHP que toma las variables del formulario de la página de formulario y lo arma para enviar por mail -->
<?php
// captura de variables se deben poner todas las variables que se crearon en el form y que se quieran enviar por mail, el nombre de la variable sale del atributo NAME de cada campo del formulario
$nombre=$_POST['nombre'];
$apellido=$_POST['apellido'];
$email=$_POST['email'];
$clave=$_POST['clave'];
$curso=$_POST['curso'];
$pais=$_POST['pais'];
$newsletter=$_POST['news'];
$comentario=$_POST['comentario'];

// cuerpo del email con los datos que se quieren enviar$mensaje="<strong>Nombre:</strong> $nombre<br /><br />
<strong>Apellido:</strong> $apellido<br /><br />
<strong>Email:</strong> $email<br /><br />
<strong>Pais:</strong> $pais<br /><br />
<strong>Curso al que se inscribe:</strong> $curso<br /><br />
<strong>Desea recibir newsletter?:</strong> $news<br /><br />
<strong>Consulta:</strong> $comentario<br /><br />";

// envío del email
mail("[email protected]", "Consulta Web Site", $mensaje, "From: $nombre <$email>\nReply-To:$email\nContent-Type: text/html; charset=iso-8859-1\n");
?>

<!-- HASTA ACA LLEGA EL CODIGO PHP -->
<!-- ESTO ES LA PAGINA WEB QUE VE LA PERSONA LUEGO QUE COMPLETA EL FORM Y QUE LE DA LAS GRACIAS se puede poner todo el diseño de la web que uno está armando -->

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link href="estilos.css" rel="stylesheet" type="text/css" />
</head>

<body STYLE="background-color:transparent">
<table width="760" height="237" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="middle" style="padding:29 30 0 110"><span class="texto_bold" style="padding-right:10px">&iexcl;&iexcl; Gracias <?php echo($nombre); ?> por su consulta !!<br>
a la brevedad nos pondremos en contacto.</span></td>
</tr>
</table>
</body>
</html>

LUEGO DE MI INTERVENCIÓN, mi código php quedó de la siguiente manera:
(quedan las anotaciones porque sino, me pierdo !!!)

<?php
// captura de variables se deben poner todas las variables que se crearon en el form y que se quieran enviar por mail, el nombre de la variable sale del atributo NAME de cada campo del formulario
$nombre=$_POST['nombre'];
$email=$_POST['email'];
$fecha=$_POST['fecha'];

// cuerpo del email con los datos que se quieren enviar
$mensaje="<strong>Nombre:</strong> $nombre<br /><br />
<strong>Email:</strong> $email<br /><br />
<strong>Fecha:</strong> $fecha<br /><br />";

// envío del email
mail("[email protected]", "Consulta Web Site", $mensaje, "From: $nombre <$email>\nReply-To:$email\nContent-Type: text/html; charset=iso-8859-1\n");
?>

¿ESTÁ BIEN HASTA ACÁ LA COSA?


PORQUE EL ASUNTO ES QUE NO FUNCIONA...
Me bajé el Wampserver (tengo W Vista) y encontré por ahí, en otro foro, la indicación de que también tenía que bajar el MINIRELAY... y lo hice...

Y cargado el sitio en la carpeta www del Wampserver, cuando relleno el formulario y presiono SEND, ahora, me sale el siguiente error:

Notice: Undefined index: email in C:\wamp\www\mail.php on line 5

La línea 5 es la que dice

$email=$_POST['email'];



ANTES ME FUE DANDO ERRORES EN DISTINTAS LÍNEAS... y no termino de entender que es lo que está mal...

¿ALGUIEN TIENE LA SUFICIENTE PACIENCIA PARA DECIRME QUÉ DEBO HACER?

¿Qué es lo que está mal luego?

GRACIAS A QUIEN TENGA VOLUNTAD DE AYUDAR!!!

SALUDOS
Verónica
  #2 (permalink)  
Antiguo 07/05/2010, 17:57
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: Notice: Undefined index: email in C:\wamp\www\mail.php on line 5

el detalle es que dichas variables funcionan en base a dos cosas:

- que el formulario de método post se haya enviado
- que exista un name con el índice solicitado, en tu caso: email

¿esta todo correcto??

porque yo no veo por ninguna parte el formulario...
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #3 (permalink)  
Antiguo 07/05/2010, 18:04
 
Fecha de Ingreso: mayo-2010
Mensajes: 7
Antigüedad: 14 años
Puntos: 0
Respuesta: Notice: Undefined index: email in C:\wamp\www\mail.php on line 5

HOLA... gracias por preocuparte..

La parte del html que tiene el form es así:

<tr>
<td align="center" valign="top" bgcolor="#67FFCC"><form id="form1" name="form1" method="post" action="file:///E|/MAXI LOPEZ/SITIO/mail.php">
<table width="230" border="0">
<tr>
<td width="156" align="left" valign="top">Nombre</td>
<td width="64" align="left" valign="top"><input name="nombre" type="text" id="nombre" size="20" /></td>
</tr>
<tr>
<td align="left" valign="top">e-mail</td>
<td align="left" valign="top"><input name="email" type="text" id="email" value="solo en minúsculas" size="20" /></td>
</tr>
<tr>
<td align="left" valign="top">Cumpleaños</td>
<td align="left" valign="top"><input name="fecha" type="text" id="fecha" value="dd/mm/aaaa" size="20" /></td>
</tr>
<tr>
<td colspan="2" align="center" valign="top"><input type="submit" name="submit" id="submit" value="ENVIAR" />
</td>
</tr>
</table>
</form></td>
</tr>

----

pero no entiendo la lo que me decís respecto a
que el formulario de método post se haya enviado

Esa parte no la entiendo...

elegí metodo POST cuando lo cree en DW...

A qué te referís?

Gracias.
Vero
  #4 (permalink)  
Antiguo 07/05/2010, 18:44
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: Notice: Undefined index: email in C:\wamp\www\mail.php on line 5

Cita:
Iniciado por vereko Ver Mensaje
[...] pero no entiendo la lo que me decís respecto a
que el formulario de método post se haya enviado

Esa parte no la entiendo...

elegí metodo POST cuando lo cree en DW...

A qué te referís? [...]
es muy sencillo, si no envías el formulario... la super variable $_POST estará vacía...

en dicho caso, si usas una variable $_POST sin haber recibido dicho formulario, entonces es por eso que saltan los errores del tipo que mencionas: "el índice foo no existe...", etc...

ahora, lo extraño es que si tienes dicho name en tu formulario... entonces, no entiendo cuando te sale el error ¿antes o después de enviar el formulario??
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #5 (permalink)  
Antiguo 07/05/2010, 19:03
 
Fecha de Ingreso: mayo-2010
Mensajes: 7
Antigüedad: 14 años
Puntos: 0
Respuesta: Notice: Undefined index: email in C:\wamp\www\mail.php on line 5

Hola Pateketrueke...

Gracias por tu paciencia...

Por alguna razón que desconozco, me dejó de dar error alguno... NI PREGUNTO !!!

No sé... SOPRESA, NO DA ERROR...

PEEEROOO... (siempre hay un pero, por Dios !!!)
No me llegan los mensajes a la casilla que indiqué en php...

Cuando pongo la de hotmail o la yahoo... me dice que las devuelve porque considera los mensajes spam
Y desde el de speedy (servidor de Buenos Aires) tampoco.
NO ME LLEGAN LOS DATOS QUE GENERA EL FORMULARIO...
No da error en la web... pero sigue fallando la cosa...

Me bajé el Mini-Relay para que funcione el servidor local y probar los formularios... pero quizás(LO MÁS PROBABLE) es que haya algo de la configuración de ese programa que no estoy haciendo.
Tengo instalados en mi máquina, tambien, el Outlook y el W. Mail... ambos los tengo asociados a distintas casillas de correo...
Y el Mini Relay me cuenta que está "Escuchando en 127.0.0.1 (Puerto 25)"
En la página del creador del programa, dice que " Simplemente hay que configurar nuestro programa de correo para que utilice la dirección IP 127.0.0.1 como servidor de SMTP. "

A que "programa de correo" se refiere?

Porqué no me llegan los datos a mi mail?

GRACIAS GRACIAS GRACIAS GRACIAS !!!!
  #6 (permalink)  
Antiguo 07/05/2010, 19:08
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: Notice: Undefined index: email in C:\wamp\www\mail.php on line 5

bueno, la recomendación de la casa es usar siempre PHPMailer y alguna cuenta de SMTP para ello...

el usar o depender de mail() es algo primitivo, y finalmente funciona bien en servidores *nix con un servidor SMTP... (:
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #7 (permalink)  
Antiguo 07/05/2010, 20:05
 
Fecha de Ingreso: mayo-2010
Mensajes: 7
Antigüedad: 14 años
Puntos: 0
Respuesta: Notice: Undefined index: email in C:\wamp\www\mail.php on line 5

Bueno... OK...

Te voy a hacer caso...

Voy a descartar el MiniRelay y me voy a instalar el que me sugerís.

En un rato te cuento..

BESO
VERO

*** ahhh... la parte de "el usar o depender de mail() es algo primitivo, y finalmente funciona bien en servidores *nix con un servidor SMTP... (: ".. no la entendí... en una semana empiezo el curso de php... A partir de ahÍ PUEDE SER, que hablemos el mismo idioma...
Soy diseñadora... y de programadora.. "cero"
GRACIAS y HASTA LUEGO !!!
  #8 (permalink)  
Antiguo 07/05/2010, 20:23
 
Fecha de Ingreso: mayo-2010
Mensajes: 7
Antigüedad: 14 años
Puntos: 0
Respuesta: Notice: Undefined index: email in C:\wamp\www\mail.php on line 5

PERDÓN... PERO ME SUPERA...

ME BAJÉ LOS FICHEROS... pero no entiendo lo que tengo que hacer...

son class de php !!!!
Te paso mi código... no entiendo como incluirlo...

VOS ME DIRÍAS ???



<?php

// captura de variables se deben poner todas las variables que se crearon en el form y que se quieran enviar por mail, el nombre de la variable sale del atributo NAME de cada campo del formulario
$nombre=$_POST['nombre'];
$email=$_POST['email'];
$fecha=$_POST['fecha'];

// cuerpo del email con los datos que se quieren enviar
$mensaje="<strong>Nombre:</strong> $nombre<br /><br />
<strong>Email:</strong> $email<br /><br />
<strong>Fecha:</strong> $fecha<br /><br />";

// envío del email
mail("[email protected]", "Consulta Web Site", $mensaje, "From: $nombre <$email>\nReply-To:$email\nContent-Type: text/html; charset=iso-8859-1\n");
?>

<!-- HASTA ACA LLEGA EL CODIGO PHP -->
<!-- ESTO ES LA PAGINA WEB QUE VE LA PERSONA LUEGO QUE COMPLETA EL FORM Y QUE LE DA LAS GRACIAS se puede poner todo el diseño de la web que uno está armando -->

<!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>
<style type="text/css">
<!--
html, body{
margin:0px;
}
#container{
widht:980px;
height:755px;
position:relative;
margin:0px auto;
width: 980px;
}
#apDiv3 {
position:absolute;
width:980px;
height:600px;
z-index:2;
top:155px;
visibility:visible;
left: 0px;
}
#apDiv1 {
position:absolute;
width:980px;
height:155px;
z-index:4;
top:0px;
visibility:visible;
left: 0px;
}
body {
background-color: #B73F0A;
}
#apDiv2 {
position:absolute;
width:980px;
height:600px;
z-index:1;
left: 0px;
top: 155px;
visibility: visible;
}
-->
</style>
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
if (event == "init" && args.length > 2) {
if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
nbArr[nbArr.length] = img;
for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
} else if (event == "over") {
document.MM_nbOver = nbArr = new Array();
for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
nbArr[nbArr.length] = img;
}
} else if (event == "out" ) {
for (i=0; i < document.MM_nbOver.length; i++) {
img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
} else if (event == "down") {
nbArr = document[grpName];
if (nbArr)
for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
document[grpName] = nbArr = new Array();
for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
nbArr[nbArr.length] = img;
} }
}
//-->
</script>
</head>


<body onload="MM_preloadImages('file:///E|/MAXI LOPEZ/SITIO/elbolicheon.jpg','file:///E|/MAXI LOPEZ/SITIO/menuypromoon.jpg','file:///E|/MAXI LOPEZ/SITIO/galeriaon.jpg','file:///E|/MAXI LOPEZ/SITIO/contactoson.jpg')">
<div id="container">

<body onload="MM_preloadImages('elbolicheon.jpg','menuyp romoon.jpg','galeriaon.jpg','contactoson.jpg')">


<div id="apDiv3">
<table width="980" border="0">
<tr>
<td width="200" align="center" valign="top"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><a href="file:///E|/MAXI LOPEZ/SITIO/home.html" target="_top" onclick="MM_nbGroup('down','group1','elboliche','f ile:///E|/MAXI LOPEZ/SITIO/elbolicheon.jpg',1)" onmouseover="MM_nbGroup('over','elboliche','file:///E|/MAXI LOPEZ/SITIO/elbolicheon.jpg','',1)" onmouseout="MM_nbGroup('out')"><img src="file:///E|/MAXI LOPEZ/SITIO/elbolicheoff.jpg" alt="el boliche" name="elboliche" width="200" height="50" border="0" id="elboliche" onload="" /></a></td>
</tr>
<tr>
<td><a href="file:///E|/MAXI LOPEZ/SITIO/menuypromociones.html" target="_top" onclick="MM_nbGroup('down','group1','menuypromocio nes','file:///E|/MAXI LOPEZ/SITIO/menuypromoon.jpg',1)" onmouseover="MM_nbGroup('over','menuypromociones', 'file:///E|/MAXI LOPEZ/SITIO/menuypromoon.jpg','',1)" onmouseout="MM_nbGroup('out')"><img src="file:///E|/MAXI LOPEZ/SITIO/menuypromooff.jpg" alt="menu y promociones" name="menuypromociones" width="200" height="50" border="0" id="menuypromociones" onload="" /></a></td>
</tr>
<tr>
<td><a href="file:///E|/MAXI LOPEZ/SITIO/galeria.html" target="_top" onclick="MM_nbGroup('down','group1','galeria','fil e:///E|/MAXI LOPEZ/SITIO/galeriaon.jpg',1)" onmouseover="MM_nbGroup('over','galeria','file:///E|/MAXI LOPEZ/SITIO/galeriaon.jpg','',1)" onmouseout="MM_nbGroup('out')"><img src="file:///E|/MAXI LOPEZ/SITIO/galeriaoff.jpg" alt="galeriaoff" name="galeria" width="200" height="50" border="0" id="galeria" onload="" /></a></td>
</tr>
<tr>
<td><a href="file:///E|/MAXI LOPEZ/SITIO/contacto.html" target="_top" onclick="MM_nbGroup('down','group1','contacto','fi le:///E|/MAXI LOPEZ/SITIO/contactoson.jpg',1)" onmouseover="MM_nbGroup('over','contacto','file:///E|/MAXI LOPEZ/SITIO/contactoson.jpg','',1)" onmouseout="MM_nbGroup('out')"><img src="file:///E|/MAXI LOPEZ/SITIO/contactosoff.jpg" alt="contacto" name="contacto" width="200" height="50" border="0" id="contacto" onload="" /></a></td>
</tr>
</table></td>

<td colspan="2" align="center" valign="middle"><table width="450" border="0">

<tr>
<td align="center" valign="middle"><span class="texto_bold" style="padding-right:10px">&iexcl;&iexcl; Gracias <?php echo($nombre); ?> !!<br />
<strong>PARA TU CUMPLEAÑOS</strong></span></td>
</tr>
<tr>
<td align="center" valign="middle"><span class="texto_bold" style="padding-right:10px">El Boliche de Darío</span></td>
</tr>
<tr>
<td align="center" valign="middle"><span class="texto_bold" style="padding-right:10px; font-weight: bold;">¡¡ TIENE UNA SORPRESA PREPARADA PARA VOS !!</span></td>
</tr>
</table></td>

<td width="261" align="left" valign="top">&nbsp;</td>
</tr>
<tr>
<td colspan="4">&nbsp;</td>
</tr>
</table>
</div>
<div id="apDiv2"><img src="file:///E|/MAXI LOPEZ/SITIO/fondo.jpg" width="980" height="600" alt="fondo boliche" /></div>
<div id="apDiv1"><img src="file:///E|/MAXI LOPEZ/SITIO/head.jpg" width="980" height="155" alt="el boliche de dario" /></div>
</div>
</body>
</html>


PREGUNTO...
NO HAY OTRO PROGRAMITA QUE FUNCIONE que no sea el MINIRELAY ????

GRACIAS...
  #9 (permalink)  
Antiguo 08/05/2010, 16:16
Avatar de jpinedo
Colaborador
 
Fecha de Ingreso: septiembre-2003
Ubicación: Lima, Perú
Mensajes: 3.120
Antigüedad: 20 años, 7 meses
Puntos: 41
Tema movido desde Configuración a PHP

Etiquetas: email, index, undefined, formulario
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 13:23.