elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.
 
Inicio Ayuda Buscar Ingresar Registrarse
28 Mayo 2012, 04:20  


Tema destacado: Recuerda que debes registrarte en el foro para poder participar (preguntar y responder)

+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web
| | |-+  PHP
| | | |-+  Novato, Ayuda con Formulario PHP
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Novato, Ayuda con Formulario PHP  (Leído 1,236 veces)
GhostLT

Desconectado Desconectado

Mensajes: 79


To know the truth,you must risk everything


Ver Perfil
Novato, Ayuda con Formulario PHP
« en: 14 Diciembre 2010, 02:59 »

Hola, disculpen me pueden ayudar?, es que no se donde debo de colocar mi correo para que me llegue lo que llenan en el formulario?  :huh:
Código
<?php
 
if(!$_POST) exit;
 
$email = $_POST['email'];
 
 
//$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS';
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){
$error.="Invalid email address entered";
$errors=1;
}
if($errors==1) echo $error;
else{
$values = array ('name','email','message');
$required = array('name','email','message');
 
$your_email = "james@example.com";
$email_subject = "New Message: ".$_POST['subject'];
$email_content = "new message:\n";
 
foreach($values as $key => $value){
 if(in_array($value,$required)){
if ($key != 'subject' && $key != 'company') {
 if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
}
$email_content .= $value.': '.$_POST[$value]."\n";
 }
}
 
if(@mail($your_email,$email_subject,$email_content)) {
echo 'Mensaje Enviado!';
} else {
echo 'ERROR!';
}
}
?>


En línea

There is some fiction in you truth, and some truth in you fiction
bomba1990


Desconectado Desconectado

Mensajes: 383



Ver Perfil WWW
Re: Novato, Ayuda con Formulario PHP
« Respuesta #1 en: 14 Diciembre 2010, 03:23 »

creo que es obvio donde dice $your_email;


En línea

"Cuando le di de comer a los pobres me llamaron santo, pero cuando pregunte porque los pobres eran pobres me dijeron comunista"

http://sosinformatico.blogspot.com/
http://www.publisnet.com.ve
GhostLT

Desconectado Desconectado

Mensajes: 79


To know the truth,you must risk everything


Ver Perfil
Re: Novato, Ayuda con Formulario PHP
« Respuesta #2 en: 14 Diciembre 2010, 04:00 »

gracias, por ayudarme, pues ya le cambie, y no he tenido exito aún...

Aquí en href= debo de cambiar algo?
Código
<li class="buttons">
             <li><a href="contact.html"><h3><strong> Enviar Mensaje</h3></strong> </a></li></li>
En línea

There is some fiction in you truth, and some truth in you fiction
Shell Root


Desconectado Desconectado

Mensajes: 2.456


Alex Jurado


Ver Perfil WWW
Re: Novato, Ayuda con Formulario PHP
« Respuesta #3 en: 14 Diciembre 2010, 04:01 »

@GhostLT, WTF! y eso que tiene que ver?
En línea

---
GhostLT

Desconectado Desconectado

Mensajes: 79


To know the truth,you must risk everything


Ver Perfil
Re: Novato, Ayuda con Formulario PHP
« Respuesta #4 en: 14 Diciembre 2010, 04:13 »

sorry, Sell Root solo que no se php y ando viendo si el error lo tengo en html
En línea

There is some fiction in you truth, and some truth in you fiction
Graphixx


Desconectado Desconectado

Mensajes: 576


Webmaster (PHP)


Ver Perfil WWW
Re: Novato, Ayuda con Formulario PHP
« Respuesta #5 en: 14 Diciembre 2010, 06:39 »

COmpañero, te recomiendo usar la libreria PHPMailer.
http://phpmailer.worxware.com/

tanto en su web como en la red hay muchos ejemplos sobre como usarla. igual y te dejo uno mio.

Código
 
<?php
session_start ();
require("class.phpmailer.php");
 
  $_nombres=strtoupper($_POST['username']);    
  $_SESSION["nombres"]=strtr($_nombres,"&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;","&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;");  
  $_nombres=$_SESSION["nombres"];  
  $_apellidos=strtoupper($_POST['username2']);
  $_SESSION["apellidos"]=strtr($_apellidos,"&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;","&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;");
  $_apellidos=$_SESSION["apellidos"];  
 
  $_SESSION["email"]=$_POST['email'];
  $_email=$_SESSION["email"];
if (!empty($_POST['email']))
{
 
              $mail = new PHPMailer();
              $mail->Host = "localhost";
              $mail->From = "registro@tuservidor.com";
              $mail->FromName = "XI Encuentro de programadores";
              $mail->Subject = "Confirmacion de registro";
 
          // HTML body
          $body ="<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'></head><body>";
          $body.="<table width=600 border=0 cellspacing=0 cellpadding=0><tr>";
              $body.="<td height=161 bgcolor=#000 style=margin:0px; padding:0px; margin:0px;height:161px;><img src=http://tuservidor.com/bannerppal.jpg width=600 height=161 style=margin:0px; padding:0px; margin:0px;></td></tr><tr>";
          $body.="<td style=font-size:12px; font-family:Arial, Helvetica, sans-serif; text-align:center; border-left:4px solid #000; border-right:4px solid #000; border-bottom:5px solid #000; border-top:4px solid #000;>";
              $body.="<center><h2><p font-size:20px>".$_nombres." ".$_apellidos."</p></h2></center>";
          $body.="<center><p><strong>Bienvenido(a) al XI Encuentro de programadores</strong></p></center>";
          $body.="<center><p>Recuerde que el evento ser&aacute; el <strong>18 y 19 de noviembre</strong> en<strong> Plaza Mayor Medell&iacute;n/Colombia.</strong></p></center>";
  $body.="<center>Las acreditaciones estar&#65533;n abiertas en plaza mayor a partir del <strong>17 de noviembre.</strong></center>";
          $body.="<center><p>Para ingresar, presente esta <strong>confirmaci&oacute;n de inscripci&oacute;n impresa</strong> o <strong>su documento de identidad.</strong></p></center>";
          $body.="<center><p>Si desea consultar de nuevo la informaci&oacute;n o actualizar sus datos, tenga presente:</p></center>";
          $body.="<center><p><strong>Clave de acceso (usuario):</strong> ".$_email."</p></center>";
          $body.="<center><p><a href=http://www.tuservidor.com target=_blank style=color:#53ACB5;><strong>www.ciudadesdigitales2010.com</strong></a><br></center>";
          $body.="<br></p></td></tr><tr>";
          $body.="<td style=margin:0px; padding:0px; margin:0px;><img src=http://tuservidor.com/pata.jpg width=600 height=118></td>";
          $body.="</tr></table></body></html>";
 
          // Text body
              $text = "confirmacion de registro XI encuentro de programadores \n\n";
          $text.="       ";
 
          // Configurar Email
          $mail->Body = $body;
          $mail->AltBody = $text;
          $mail->AddAddress($_email, $_nombres);
          // Enviar el email
          if(!$mail->Send()) {
        echo "Error al enviar a: " . $_email . "<br>";
          }
            $mail->ClearAddresses();
 
}
              header( "Location: confirmacion.php?num_doc=".$_num_doc );
  session_destroy();                                                          
}
else                                                                  
{
       echo "<blockquote><blockquote><blockquote><p><br><br><a href='primero.php'><--Regresar</a></p></blockquote></blockquote></blockquote>";
   }
?>
 

tambien cuando hallas avanzado otro poco, echale una mirada a PHPLIST.
http://www.phplist.com/

Y como acote final , el mejor servidor local portable para compilar tus proyectos PHP:
MOWES, EL MEJOR SOFTWARE PORTABLE: APACHE + MYSQL + PHP + PHPMYADMIN
http://foro.elhacker.net/empty-t288931.0.html

______________________
PD: ALgun mod me indica por que mi codigo no se colorea, gracias....y si no es mucha molestia lo arreglan jejejjeje
« Última modificación: 17 Diciembre 2010, 01:59 por Graphixx » En línea

Shell Root


Desconectado Desconectado

Mensajes: 2.456


Alex Jurado


Ver Perfil WWW
Re: Novato, Ayuda con Formulario PHP
« Respuesta #6 en: 14 Diciembre 2010, 18:35 »

PD: ALgun mod me indica por que mi codigo no se colorea, gracias....y si no es mucha molestia lo arreglan jejejjeje
hahahahaha no soy moderador, pero es fácil de responder esta pregunta. Es porque no señalaste a que tipo de lenguaje pertenece tú código, es decir, la etiqueta es la siguiente [ CODE ][/ CODE ], para indicar el lenguaje debería ser el siguiente -sin los espacios-, [ CODE=PHP ][/ CODE ]
En línea

---
Bytheface

Desconectado Desconectado

Mensajes: 66


Ver Perfil
Re: Novato, Ayuda con Formulario PHP
« Respuesta #7 en: 15 Diciembre 2010, 23:33 »

Seguramente no te llegue por culpa de los headers, ya que segun a que correo y de donde lo envies, puede ser que no lleguen siquiera.

Tambien puede ser que el host donde estes probando no tenga bien configurado el smtp.

Yo voto tambien por PHPMailer, te ahorra muchisimo trabajo y trae bastantes opciones. El problema es que aunque lo puedas usar, igual te cuesta entenderlo ya que como dices, no sabes php, aunque la verdad que la POO hace que todo se vea muchisimo mas claro.
En línea
marcofbb

Desconectado Desconectado

Mensajes: 26


Ver Perfil
Re: Novato, Ayuda con Formulario PHP
« Respuesta #8 en: 8 Enero 2011, 16:39 »

http://www.entra-ya.com.ar/enviar-mails-con-php/
En línea
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Powered by SMF 1.1.16 | SMF © 2006-2008, Simple Machines