Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/01/2011, 13:50
Avatar de fernando2222
fernando2222
 
Fecha de Ingreso: diciembre-2009
Mensajes: 110
Antigüedad: 14 años, 4 meses
Puntos: 1
Formulario de contacto

Alguien sabe decirme si hay algo mal en este codigo?

!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=iso-8859-1" />
<title>contactoht</title>
<script type="text/JavaScript">
<!--
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_validateForm() { //v4.0
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=MM_findObj(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>
<style type="text/css">
<!--
body {
background-color: #999999;
}
-->
</style></head>

<body>
<form action="contact.php" method="POST" onsubmit="MM_validateForm('EmailFrom','','RisEmail ');MM_validateForm('Nombre','','R');MM_validateFor m('consulta','','R');return document.MM_returnValue">
<p>Email:<br>
<input type="text" name="EmailFrom">
<p>Nombre:<br>
<input type="text" name="Nombre">
<p>Apellido (opcional) <br>
<input type="text" name="Name">
<p>consulta:<br>
<textarea name="consulta" cols="30" rows="10"></textarea>
<p>

<p>
<input type="submit" name="submit" value="Enviar" />

</form>
<p>

<!-- Contact Form credit link -->

</body>
</html>

Y aqui va el de php


<?php
// Website Contact Form Generator
// http://www.tele-pro.co.uk/scripts/contact_form/
// This script is free to use as long as you
// retain the credit link

// get posted data into local variables
$EmailFrom = Trim(stripslashes($_POST['e-mail']));
$EmailTo = "[email protected]";
$Subject = "consulta uno";
$Nombre = Trim(stripslashes($_POST['Nombre']));
$Apellido= Trim(stripslashes($_POST['Apellido']));
$consulta = Trim(stripslashes($_POST['consulta']));

// validation
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}

// prepare email body text
$Body = "";
$Body .= "Nombre: ";
$Body .= $Nombre;
$Body .= "\n";
$Body .= "Apellido: ";
$Body .= $Apellido;
$Body .= "\n";
$Body .= "consulta: ";
$Body .= $consulta;
$Body .= "\n";

// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
__________________
__________________
www.mshunderwear.com.ar la marca del momento....