Foros del Web » Programando para Internet » PHP »

AYUDA configuracion con formulario y configuracion php

Estas en el tema de AYUDA configuracion con formulario y configuracion php en el foro de PHP en Foros del Web. formulario: <!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>Formulario</title> <style type="text/css"> <!-- body,td,th { color: #F60; ...

  #61 (permalink)  
Antiguo 17/12/2009, 15:51
 
Fecha de Ingreso: diciembre-2009
Mensajes: 34
Antigüedad: 14 años, 4 meses
Puntos: 0
Respuesta: AYUDA configuracion con formulario y configuracion php

formulario:

<!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>Formulario</title>
<style type="text/css">
<!--
body,td,th {
color: #F60;
}
body {
background-color: #FFF;
}
body div {
color: #F30;
}
body {
color: #F30;
}
body div {
color: #F60;
}
-->
</style>
<script type="text/javascript">
<!--
function MM_validateForm() { //v4.0
if (document.getElementById){
var i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
} }
//-->
</script>
</head>

<body>
<div align="center"><strong>ESCUELA DE DANZA CONTEMPORÁNEA </strong></div>
<br>
<div align="center"><font color="#000000">Para mayor información llena el siguiente formulario y nos pondremos en contacto contigo</font> </div><br>
<form action="formula.php" method="post" target="_self" id="formulario" onsubmit="MM_validateForm('nombreinteresado','','R ','apellidopat','','R','apellidomat','','R','email ','','RisEmail');return document.MM_returnValue">
<table align="center">
<tr>
<td align="right" valign="top"><label for="nombreinteresado">Nombre</label></td>
<td><input name="nombreinteresado" type="text" id="nombreinteresado" onblur="MM_validateForm('nombreinteresado','','R') ;return document.MM_returnValue" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="apellidopat">Apellido Paterno</label></td>
<td><input name="apellidopat" type="text" id="apellidopat" onblur="MM_validateForm('apellidopat','','R');retu rn document.MM_returnValue" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="apellidomat">Apellido Materno</label></td>
<td><input name="apellidomat" type="text" id="apellidomat" onblur="MM_validateForm('nombreinteresado','','R') ;return document.MM_returnValue" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="documentoid">Documento de Identidad</label></td>
<td><select name="documentoid" id="documentoid">
<option>DNI</option>
<option>PASAPORTE</option>
</select>
<label for="documentoid"></label>
<input type="text" name="documentoid" id="documentoid" /></td>
</tr>
<tr>
<td align="right" valign="middle">Sexo</td>
<td><p>
<label>
<input type="radio" name="Sexo" value="M" id="Sexo_0" />
Masculino</label>
<br />
<label>
<input type="radio" name="Sexo" value="F" id="Sexo_1" />
Femenino</label>
<br />
</p></td>
</tr>
<tr>
<td align="right" valign="top"><label for="fechanac">Fecha de Nacimiento</label></td>
<td><input name="fechanac" type="text" id="fechanac" value="dd/mm/aa" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="celular">Celular</label></td>
<td><input type="text" name="celular" id="celular" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="email">Email</label></td>
<td><input type="text" name="email" id="email" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="Direccion">Dirección</label></td>
<td><input type="text" name="Direccion" id="Direccion" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="departamento">Departamento</label></td>
<td><input type="text" name="departamento" id="departamento" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="provincia">Provincia</label></td>
<td><input type="text" name="provincia" id="provincia" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="distrito">Distrito</label></td>
<td><input type="text" name="distrito" id="distrito" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="consulta">Consulta</label></td>
<td><textarea name="consulta" id="consulta" cols="45" rows="5">
</textarea></td>
</tr>
<tr>
<td align="right" valign="top">&nbsp;</td>
<td><label>
<input name="info" type="checkbox" id="info" value="yes" />
Deseo recibir información </label></td>
</tr>
<tr>
<td align="right" valign="top">&nbsp;</td>
<td><input type="reset" name="Limpiar" id="Limpiar" value="Limpiar " /> <input type="submit" name="Enviar" id="Enviar" value="Enviar" /></td>
</tr>
</table>
</form>
</body>
</html>
  #62 (permalink)  
Antiguo 17/12/2009, 15:52
 
Fecha de Ingreso: diciembre-2009
Mensajes: 34
Antigüedad: 14 años, 4 meses
Puntos: 0
Respuesta: AYUDA configuracion con formulario y configuracion php

y el php q me dio blogger:

<?PHP
$nombre = $_POST['nombreinteresado'];
$apellidopat = $_POST['apellidopat'];
$apellidomat= $_POST['apellidomat'];
$documentid = $_POST['documentoid'];
$sexo = $_POST['sexo'];
$fechanac = $_POST['fechanac'];
$celular = $_POST['celular'];
$email = $_POST['email'];
$direccion = $_POST['Direccion'];
$departamento = $_POST['departamento'];
$provincia = $_POST['provincia'];
$distrito = $_POST['distrito'];

$sendTo = "*****@gmail.com";
$subject = "Interesados por ******";

$correoEnviar="Su Apellido paterno es <b>".$apellidopat."<BR>
Su Apellido materno es <b>".$apellidomat."<BR>
Su documento de identidad es ".$documentoid."<BR>
Es ".$sexo."<BR>
Nacio ".$fechanac."<BR>
Su número de celular es ".$celular."<BR>
Su correo es ".$email."<BR>
Su direccion es ".$direccion."<BR>
Vive en el departamento de ".$departamento."<BR>
Provincia de ".$provincia."<BR>
En el distrito de ".$distrito."<BR>";
mail($sendTo,$subject,$correoEnviar);

if (isset($_POST['enviar'])) {
?>
<!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>
</head>
<body>
<?PHP
echo $nombre."<BR>n";
echo "Su Apellido paterno es <b>".$apellidopat."<BR>";
echo "Su Apellido materno es <b>".$apellidomat."<BR>";
echo "Su documento de identidad es ".$documentoid."<BR>";
echo "Es ".$sexo."<BR>";
echo "Nacio ".$fechanac."<BR>";
echo "Su número de celular es ".$celular."<BR>";
echo "Su correo es ".$email."<BR>";
echo "Su direccion es ".$direccion."<BR>";
echo "Vive en el departamento de ".$departamento."<BR>";
echo "Provincia de ".$provincia."<BR>";
echo "En el distrito de ".$distrito."<BR>";}
echo "Gracias, el mensaje se enviado con Exito";
Else {
echo "No funciono";
}
?>
</body>
</html>
  #63 (permalink)  
Antiguo 17/12/2009, 15:55
Avatar de blogger  
Fecha de Ingreso: diciembre-2005
Ubicación: frente al monitor
Mensajes: 398
Antigüedad: 18 años, 4 meses
Puntos: 12
Respuesta: AYUDA configuracion con formulario y configuracion php

Wow, sigues usando el código PHP sin corregir, por eso te sigue marcando el error
__________________
http://exegesis-biblica.com/
  #64 (permalink)  
Antiguo 17/12/2009, 15:59
Avatar de blogger  
Fecha de Ingreso: diciembre-2005
Ubicación: frente al monitor
Mensajes: 398
Antigüedad: 18 años, 4 meses
Puntos: 12
Respuesta: AYUDA configuracion con formulario y configuracion php

Código PHP:
Ver original
  1. echo "En el distrito de ".$distrito."<BR>";}
  2. echo "Gracias, el mensaje se enviado con Exito";
  3. Else {
  4. echo "No funciono";
  5. }

Fue corregido a:

Código PHP:
Ver original
  1. echo "En el distrito de ".$distrito."<BR>";
  2. echo "Gracias, el mensaje se enviado con Exito";
  3. }
  4. Else {
  5. echo "No funciono";
  6. }
__________________
http://exegesis-biblica.com/
  #65 (permalink)  
Antiguo 17/12/2009, 16:13
 
Fecha de Ingreso: diciembre-2009
Mensajes: 34
Antigüedad: 14 años, 4 meses
Puntos: 0
Respuesta: AYUDA configuracion con formulario y configuracion php

parece q funciona salio esto
alejandro
nSu Apellido paterno es magno
Su Apellido materno es milla
Su documento de identidad es 50048731
Es
Nacio 02/02/1978
Su n�mero de celular es 990071538
Su correo es [email protected]
Su direccion es los alamos
Vive en el departamento de lima
Provincia de lima
En el distrito de san miguel
Gracias, el mensaje se enviado con Exito

revisare mi gmail
  #66 (permalink)  
Antiguo 17/12/2009, 16:22
Avatar de SirDuque  
Fecha de Ingreso: febrero-2009
Ubicación: Paso del Rey, Buenos Aires, Argentina
Mensajes: 975
Antigüedad: 15 años, 2 meses
Puntos: 89
Respuesta: AYUDA configuracion con formulario y configuracion php

Aver te corregi HTML y el PHP.... fijate:

Código HTML:
formulario:

<!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>Formulario</title>
<style type="text/css">
<!--
body,td,th {
color: #F60;
}
body {
background-color: #FFF;
}
body div {
color: #F30;
}
body {
color: #F30;
}
body div {
color: #F60;
}
-->
</style>
<script type="text/javascript">
<!--
function MM_validateForm() { //v4.0
if (document.getElementById){
var i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
} }
//-->
</script>
</head>

<body>
<div align="center"><strong>ESCUELA DE DANZA CONTEMPORÁNEA </strong></div>
<br>
<div align="center"><font color="#000000">Para mayor información llena el siguiente formulario y nos pondremos en contacto contigo</font> </div><br>
<form action="formula.php" method="post" target="_self" id="formulario" onsubmit="MM_validateForm('nombreinteresado','','R ','apellidopat','','R','apellidomat','','R','email ','','RisEmail');return document.MM_returnValue">
<table align="center">
<tr>
<td align="right" valign="top"><label for="nombreinteresado">Nombre</label></td>
<td><input name="nombreinteresado" type="text" id="nombreinteresado" onblur="MM_validateForm('nombreinteresado','','R') ;return document.MM_returnValue" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="apellidopat">Apellido Paterno</label></td>
<td><input name="apellidopat" type="text" id="apellidopat" onblur="MM_validateForm('apellidopat','','R');retu rn document.MM_returnValue" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="apellidomat">Apellido Materno</label></td>
<td><input name="apellidomat" type="text" id="apellidomat" onblur="MM_validateForm('nombreinteresado','','R') ;return document.MM_returnValue" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="documentoid">Documento de Identidad</label></td>
<td><select name="documentoid" id="documentoid">
<option>DNI</option>
<option>PASAPORTE</option>
</select>
<label for="documentoid"></label>
<input type="text" name="documentoid" id="numerodocumentoid" /></td>
</tr>
<tr>
<td align="right" valign="middle">Sexo</td>
<td><p>
<label>
<input type="radio" name="Sexo" value="M" id="Sexo_0" />
Masculino</label>
<br />
<label>
<input type="radio" name="Sexo" value="F" id="Sexo_1" />
Femenino</label>
<br />
</p></td>
</tr>
<tr>
<td align="right" valign="top"><label for="fechanac">Fecha de Nacimiento</label></td>
<td><input name="fechanac" type="text" id="fechanac" value="dd/mm/aa" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="celular">Celular</label></td>
<td><input type="text" name="celular" id="celular" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="email">Email</label></td>
<td><input type="text" name="email" id="email" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="Direccion">Dirección</label></td>
<td><input type="text" name="Direccion" id="Direccion" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="departamento">Departamento</label></td>
<td><input type="text" name="departamento" id="departamento" /></td>

</tr>
<tr>
<td align="right" valign="top"><label for="provincia">Provincia</label></td>
<td><input type="text" name="provincia" id="provincia" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="distrito">Distrito</label></td>
<td><input type="text" name="distrito" id="distrito" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="consulta">Consulta</label></td>
<td><textarea name="consulta" id="consulta" cols="45" rows="5">
</textarea></td>
</tr>
<tr>
<td align="right" valign="top">&nbsp;</td>
<td><label>
<input name="info" type="checkbox" id="info" value="yes" />
Deseo recibir información </label></td>
</tr>
<tr>
<td align="right" valign="top">&nbsp;</td>
<td><input type="reset" name="Limpiar" id="Limpiar" value="Limpiar " /> <input type="submit" name="Enviar" id="Enviar" value="Enviar" /></td>
</tr>
</table>
</form>
</body>
</html> 
PHP:
Código PHP:
<?PHP
$nombre 
$_POST['nombreinteresado'];
$apellidopat $_POST['apellidopat'];
$apellidomat$_POST['apellidomat'];
$documentid $_POST['documentoid'];
$numerodocumentid $_POST['numerodocumentoid']; // se pisaban las variables
$sexo $_POST['sexo'];
$fechanac $_POST['fechanac'];
$celular $_POST['celular'];
$email $_POST['email'];
$direccion $_POST['Direccion'];
$departamento $_POST['departamento'];
$provincia $_POST['provincia'];
$distrito $_POST['distrito'];
$distrito $_POST['consulta'];//no estaba

$header 'From: ' $email " \r\n";
$header .= "X-Mailer: PHP/" phpversion() . " \r\n";
$header .= "Mime-Version: 1.0 \r\n";
$header .= "Content-Type: text/plain";


$sendTo '*****@gmail.com';   // esto ' ,no comillas
$subject 'Interesados por ******';// esto ' ,no comillas


$mailtxt "Formulario WEB\n";
$mailtxt. = "Su Apellido paterno es <b>".$_POST['apellidopat']." \n";
$mailtxt. = "Su Apellido materno es <b>".$_POST['apellidomat']." \n";
$mailtxt. = "Su documento de identidad es ".$_POST['documentoid'].":".$_POST['numerodocumentoid']." \n";
$mailtxt. = "Es: ".$_POST['sexo']." \n";
$mailtxt. = "Nacio: ".$_POST['fechanac']."\n";
$mailtxt. = "Su número de celular es: ".$_POST['celular']."\n";
$mailtxt. = "Su correo es: ".$_POST['email']."\n";
$mailtxt. = "Su direccion es ".$_POST['Direccion']."\n";
$mailtxt. = "Vive en el departamento de ".$_POST['departamento']."\n";
$mailtxt. = "Provincia de ".$_POST['provincia']."\n";
$mailtxt. = "En el distrito de ".$_POST['distrito']."\n";
$mailtxt. = "MENSAJE: \n".$_POST['consulta']."\n";

mail($sendTo,$subject,utf8_decode($mailtxt), $header);

echo 
'Gracias por usar este medio';
echo 
"Los datos completados fueron:\n\n"
echo "Nombre Contacto:".$_POST['nombreinteresado']."\n";
echo 
"Apellido paterno: ".$_POST['apellidopat']."\n";
echo 
"Apellido materno: ".$_POST['apellidomat']."\n";
echo .
$_POST['documentoid'].":".$_POST['numerodocumentoid']."\n";
echo 
"Sexo:".$_POST['sexo']."\n";
echo 
"Nacido el: ".$_POST['fechanac']."\n";
echo 
"Celular: ".$_POST['celular']."\n";
echo 
"E-mail: ".$_POST['email']."\n";
echo 
"Direccion: ".$_POST['departamento']. " Departamento" "\n";
echo 
"Provincia: ".$_POST['provincia']."\n";
echo 
"Distrito: ".$_POST['distrito']."\n";
echo 
"Mensaje:\n\n ".$_POST['consulta']."\n";
echo 
"\n\n Sus datos fueron enviados con exito."


?>
Como dijo blogger estaba sin corregir.
Saludos
  #67 (permalink)  
Antiguo 17/12/2009, 16:26
 
Fecha de Ingreso: diciembre-2009
Mensajes: 34
Antigüedad: 14 años, 4 meses
Puntos: 0
Respuesta: AYUDA configuracion con formulario y configuracion php

funciona funciona!!!!!!!!!!!!!!

muchisimas gracias sirduque, darkasecas y sobre todo a mi compadre blogger
son de lo mejor!!!! perdonen las molestias...y nada reitero mis agradecimientos!! mi primer post y q tal ayuda!!!! el mejor foro wow!
  #68 (permalink)  
Antiguo 17/12/2009, 16:35
Avatar de SirDuque  
Fecha de Ingreso: febrero-2009
Ubicación: Paso del Rey, Buenos Aires, Argentina
Mensajes: 975
Antigüedad: 15 años, 2 meses
Puntos: 89
Respuesta: AYUDA configuracion con formulario y configuracion php

Cita:
Iniciado por renzilla Ver Mensaje
funciona funciona!!!!!!!!!!!!!!

muchisimas gracias sirduque, darkasecas y sobre todo a mi compadre blogger
son de lo mejor!!!! perdonen las molestias...y nada reitero mis agradecimientos!! mi primer post y q tal ayuda!!!! el mejor foro wow!
Bueno estas preguntas sobre los FORM y PHP son muy frecuentes... con este ejemplo de apoco lo vas a entender... y cuando veas algo similar, da tu aporte al q lo necesita.
  #69 (permalink)  
Antiguo 17/12/2009, 16:51
 
Fecha de Ingreso: diciembre-2009
Mensajes: 34
Antigüedad: 14 años, 4 meses
Puntos: 0
Respuesta: AYUDA configuracion con formulario y configuracion php

de ley
este foro sera de cabecera
  #70 (permalink)  
Antiguo 18/12/2009, 08:13
Avatar de blogger  
Fecha de Ingreso: diciembre-2005
Ubicación: frente al monitor
Mensajes: 398
Antigüedad: 18 años, 4 meses
Puntos: 12
Respuesta: AYUDA configuracion con formulario y configuracion php

Cita:
Iniciado por renzilla Ver Mensaje
funciona funciona!!!!!!!!!!!!!!

muchisimas gracias sirduque, darkasecas y sobre todo a mi compadre blogger
son de lo mejor!!!! perdonen las molestias...y nada reitero mis agradecimientos!! mi primer post y q tal ayuda!!!! el mejor foro wow!
De nada, estamos aquí para ayudarnos.
__________________
http://exegesis-biblica.com/
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 08:56.