tambien tiene un js que hace la validacion de un par de campos (como que el mail sea valido)
funciona la validacion y el guardar los datos en la base, pero no me esta llegando el correo...
les dejo el codigo completo para que vean q puede ser lo que esta fallando
aca esta el fon arriba:
http://zorpstudio.cl/cloverdale/contact_interest.php
y aca el codigo:
Código PHP :
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>749 Cloverdale</title> <link href="style.css" rel="stylesheet" type="text/css"> <link href='http://fonts.googleapis.com/css?family=Raleway:400,100,200,300,500,600,700' rel='stylesheet' type='text/css'> <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'></script> <script src='js/funciones.js'></script> </head> <body> <?php if(isset($_POST['submit-button'])){ if($_POST['firstname'] == ''){ $error1 = '<span class="error">Ingrese su nombre</span>'; }else if($_POST['email'] == '' or !preg_match("/^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/",$_POST['email'])){ $error2 = '<span class="error">Ingrese un email correcto</span>'; }else if($_POST['lastname'] == ''){ $error3 = '<span class="error">Ingrese un apellido</span>'; }else if($_POST['zipcode'] == ''){ $error4 = '<span class="error">Ingrese un zip</span>'; }else{ $dest = "[email protected]"; //Email de destino $firstname = $_POST['firstname']; $email = $_POST['email']; $lastname = $_POST['lastname']; //Asunto $zopcode = $_POST['zipcode']; //Cuerpo del mensaje //Cabeceras del correo $headers = "From: $firstname $email\r\n"; //Quien envia? $headers .= "X-Mailer: PHP5\n"; $headers .= 'MIME-Version: 1.0' . "\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // if(mail($dest,$lastname,$zipcode,$headers)){ $result = '<div class="result_ok">Email enviado correctamente :)</div>'; // si el envio fue exitoso reseteamos lo que el usuario escribio: $_POST['firstname'] = ''; $_POST['email'] = ''; $_POST['lastname'] = ''; $_POST['zipcode'] = ''; }else{ $result = '<div class="result_fail">Hubo un error al enviar el mensaje :(</div>'; } } } ?> <? # nombre del usuario y su email pasados por la URL /* -- utilizas trim para quitar espacios -- */ $firstname = trim($_POST['firstname']); $lastname = trim($_POST['lastname']); $address = trim($_POST['address']); $city = trim($_POST['city']); $countrystate = trim($_POST['countrystate']); $zipcode = trim($_POST['zipcode']); $country = trim($_POST['country']); $phone = trim($_POST['phone']); $email = trim($_POST['email']); $broker = trim($_POST['broker']); $time = trim($_POST['time']); $preferred = trim($_POST['preferred']); # nombre de la base de datos y de la tabla $base = "zorp_email"; $tabla = "contacts"; # conectar base de datos $conectar = mysql_connect("localhost","zorp","magnoz"); mysql_select_db($base,$conectar); # instrucción SQL para insertar datos $ssql = "INSERT INTO $tabla (firstname,email,lastname,address,city,countrystate,zipcode,country,phone,broker,time,preferred) VALUES ('$firstname','$email','$lastname','$address','$city','$countrystate','$zipcode','$country','$phone','$broker','$time','$preferred')"; $insertar = mysql_query($ssql,$conectar); # if(mysql_error($conectar) == 0) { echo ""; } mysql_close($conectar); ?> <div id="container"> <div id="header"><a href="index.html"> <div id="logo"></div></a> </div> <div class="content"> <a href="index.html"><div id="back"><li>Back</li></div></a> <div style="width:650px; margin-left:60px;"> <div id="title" style="line-height:30px;">Please enter your information and one of our sales associates will contact you.</div> <p></p> <div id="contact"> <div style="padding-left:15px;"> <form name=formulario method='POST' action=''> <div style="height:40px; margin-top:50px;"> <div class="text">First Name*:</div> <input name=firstname type=text class="firstname" id=nom size=15><?php echo $error1 ?> </div> <div style="height:40px;"> <div class="text">Last Name*:</div><input name=lastname type=text class="lastname" id=nom size=15><?php echo $error2 ?> </div> <div style="height:40px; margin-top:50px;"> <div class="text">Address:</div> <input name=address type=text class="large" id=ema size=15> </div> <div style="height:40px; width:310px; float:left;"> <div class="text">City:</div> <input name=city type=text class="shorts" id=ema size=15></div> <div style="height:40px; width:310px; float:right;"> <div class="text1">State:</div> <select name="countrystate"> <option>Alabama</option> <option>Alaska</option> <option>Arizona</option> <option>Arkansas</option> <option>California</option> <option>Colorado</option> <option>Connecticut</option> <option>Delaware</option> <option>Florida</option> <option>Georgia</option> <option>Hawaii</option> <option>Idaho</option> <option>Illinois</option> <option>Indiana</option> <option>Iowa</option> <option>Kansas</option> <option>Kentucky</option> <option>Louisiana</option> <option>Maine</option> <option>Maryland</option> <option>Massachusetts</option> <option>Michigan</option> <option>Minnesota</option> <option>Mississippi</option> <option>Missouri</option> <option>Montana</option> <option>Nebraska</option> <option>Nevada</option> <option>New Hampshire</option> <option>New Jersey</option> <option>New Mexico</option> <option>New York</option> <option>North Carolina</option> <option>North Dakota</option> <option>Ohio</option> <option>Oklahoma</option> <option>Oregon</option> <option>Pennsylvania</option> <option>Rhode Island</option> <option>South Carolina</option> <option>South Dakota</option> <option>Tennessee</option> <option>Texas</option> <option>Utah</option> <option>Vermont</option> <option>Virginia</option> <option>Washington</option> <option>West Virginia</option> <option>Wisconsin</option> <option>Wyoming</option> </select> </div> <div style="width:635px; float:left;"> <div style="height:40px; width:310px; float:left;"> <div class="text">Zip*:</div><input name=zipcode type=text class="zipcode" id=ema size=15><?php echo $error3 ?> </div> <div style="height:40px; width:310px; float:right;"> <div class="text1">Country:</div> <select name="country"> <option>Afghanistan</option> <option>Albania</option> <option>Algeria</option> <option>American Samoa</option> <option>Andorra</option> <option>Angola</option> <option>Anguilla</option> <option>Antarctica</option> <option>Antigua and Barbuda</option> <option>Argentina</option> <option>Armenia</option> <option>Aruba</option> <option>Australia</option> <option>Austria</option> <option>Azerbaijan</option> <option>Bahamas</option> <option>Bahrain</option> <option>Bangladesh</option> <option>Barbados</option> <option>Belarus</option> <option>Belgium</option> <option>Belize</option> <option>Benin</option> <option>Bermuda</option> <option>Bhutan</option> <option>Bolivia</option> <option>Bosnia and Herzegovina</option> <option>Botswana</option> <option>Bouvet Island</option> <option>Brazil</option> <option>British Indian Ocean Territory</option> <option>Brunei Darussalam</option> <option>Bulgaria</option> <option>Burkina Faso</option> <option>Burundi</option> <option>Cambodia</option> <option>Cameroon</option> <option>Canada</option> <option>Cape Verde</option> <option>Cayman Islands</option> <option>Central African Republic</option> <option>Chad</option> <option>Chile</option> <option>China</option> <option>Christmas Island</option> <option>Cocos Islands</option> <option>Colombia</option> <option>Comoros</option> <option>Congo</option> <option>Congo, Democratic Republic of the</option> <option>Cook Islands</option> <option>Costa Rica</option> <option>Cote d'Ivoire</option> <option>Croatia</option> <option>Cuba</option> <option>Cyprus</option> <option>Czech Republic</option> <option>Denmark</option> <option>Djibouti</option> <option>Dominica</option> <option>Dominican Republic</option> <option>Ecuador</option> <option>Egypt</option> <option>El Salvador</option> <option>Equatorial Guinea</option> <option>Eritrea</option> <option>Estonia</option> <option>Ethiopia</option> <option>Falkland Islands</option> <option>Faroe Islands</option> <option>Fiji</option> <option>Finland</option> <option>France</option> <option>French Guiana</option> <option>French Polynesia</option> <option>Gabon</option> <option>Gambia</option> <option>Georgia</option> <option>Germany</option> <option>Ghana</option> <option>Gibraltar</option> <option>Greece</option> <option>Greenland</option> <option>Grenada</option> <option>Guadeloupe</option> <option>Guam</option> <option>Guatemala</option> <option>Guinea</option> <option>Guinea-Bissau</option> <option>Guyana</option> <option>Haiti</option> <option>Heard Island and McDonald Islands</option> <option>Honduras</option> <option>Hong Kong</option> <option>Hungary</option> <option>Iceland</option> <option>India</option> <option>Indonesia</option> <option>Iran</option> <option>Iraq</option> <option>Ireland</option> <option>Israel</option> <option>Italy</option> <option>Jamaica</option> <option>Japan</option> <option>Jordan</option> <option>Kazakhstan</option> <option>Kenya</option> <option>Kiribati</option> <option>Kuwait</option> <option>Kyrgyzstan</option> <option>Laos</option> <option>Latvia</option> <option>Lebanon</option> <option>Lesotho</option> <option>Liberia</option> <option>Libya</option> <option>Liechtenstein</option> <option>Lithuania</option> <option>Luxembourg</option> <option>Macao</option> <option>Madagascar</option> <option>Malawi</option> <option>Malaysia</option> <option>Maldives</option> <option>Mali</option> <option>Malta</option> <option>Marshall Islands</option> <option>Martinique</option> <option>Mauritania</option> <option>Mauritius</option> <option>Mayotte</option> <option>Mexico</option> <option>Micronesia</option> <option>Moldova</option> <option>Monaco</option> <option>Mongolia</option> <option>Montenegro</option> <option>Montserrat</option> <option>Morocco</option> <option>Mozambique</option> <option>Myanmar</option> <option>Namibia</option> <option>Nauru</option> <option>Nepal</option> <option>Netherlands</option> <option>Netherlands Antilles</option> <option>New Caledonia</option> <option>New Zealand</option> <option>Nicaragua</option> <option>Niger</option> <option>Nigeria</option> <option>Norfolk Island</option> <option>North Korea</option> <option>Norway</option> <option>Oman</option> <option>Pakistan</option> <option>Palau</option> <option>Palestinian Territory</option> <option>Panama</option> <option>Papua New Guinea</option> <option>Paraguay</option> <option>Peru</option> <option>Philippines</option> <option>Pitcairn</option> <option>Poland</option> <option>Portugal</option> <option>Puerto Rico</option> <option>Qatar</option> <option>Romania</option> <option>Russian Federation</option> <option>Rwanda</option> <option>Saint Helena</option> <option>Saint Kitts and Nevis</option> <option>Saint Lucia</option> <option>Saint Pierre and Miquelon</option> <option>Saint Vincent and the Grenadines</option> <option>Samoa</option> <option>San Marino</option> <option>Sao Tome and Principe</option> <option>Saudi Arabia</option> <option>Senegal</option> <option>Serbia</option> <option>Seychelles</option> <option>Sierra Leone</option> <option>Singapore</option> <option>Slovakia</option> <option>Slovenia</option> <option>Solomon Islands</option> <option>Somalia</option> <option>South Africa</option> <option>South Georgia</option> <option>South Korea</option> <option>Spain</option> <option>Sri Lanka</option> <option>Sudan</option> <option>Suriname</option> <option>Svalbard and Jan Mayen</option> <option>Swaziland</option> <option>Sweden</option> <option>Switzerland</option> <option>Syrian Arab Republic</option> <option>Taiwan</option> <option>Tajikistan</option> <option>Tanzania</option> <option>Thailand</option> <option>The Former Yugoslav Republic of Macedonia</option> <option>Timor-Leste</option> <option>Togo</option> <option>Tokelau</option> <option>Tonga</option> <option>Trinidad and Tobago</option> <option>Tunisia</option> <option>Turkey</option> <option>Turkmenistan</option> <option>Tuvalu</option> <option>Uganda</option> <option>Ukraine</option> <option>United Arab Emirates</option> <option>United Kingdom</option> <option selected>United States</option> <option>United States Minor Outlying Islands</option> <option>Uruguay</option> <option>Uzbekistan</option> <option>Vanuatu</option> <option>Vatican City</option> <option>Venezuela</option> <option>Vietnam</option> <option>Virgin Islands, British</option> <option>Virgin Islands, U.S.</option> <option>Wallis and Futuna</option> <option>Western Sahara</option> <option>Yemen</option> <option>Zambia</option> <option>Zimbabwe</option> </select> </div> </div> <div style="width:635px; float:left;"> <div style="height:40px; width:310px; float:left;"> <div class="text">Phone:</div> <input name=phone type=text class="shorts" id=ema size=15> </div> <div style="height:40px; width:310px; float:right;"> <div class="text1">Email*:</div> <input name=email type=text class="email" id=ema size=15><?php echo $error4 ?> </div> </div> <div style="width:500px; margin-top:50px; margin-right:50px; margin-bottom:30px; float:right; display:block;"> <div class="text2">Are you a broker?:</div> <select name="broker" class="shorts1"> <option>Yes</option> <option>No</option> </select> <br> <div class="text2">Time to buy:</div> <select name="time" class="shorts1"> <option>Yes</option> <option>No</option> </select> <br> <div class="text2">Preferred method of contact:</div> <select name="preferred" class="shorts1"> <option>Yes</option> <option>No</option> </select> </div> </p> <p> </p> <p> </p> <div style="text-align:right; margin-top:200px; margin-bottom:40px; display:block;"> <input type=submit class="submit-button" value=Register> <div><?php echo $result; ?></div> </div> <div style="text-align:right; padding-right:50px; margin-top:10px; margin-bottom:40px; font-size:12px;">*required</div> </form> </div> </div> </div> </div> <!-- end .content --></div> <!-- end .container --></div> <div id="footer"> <a class=Ntooltip href=""> <div id="legal"> <img style="margin-right:5px" src="images/legal.gif" width="18" height="15" alt="Legal"> Legal</div> <span> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut quis leo turpis, et elementum eros. Nunc consectetur dolor eu nunc vulputate tempor. Quisque sit amet ipsum et orci mollis tincidunt </span> </a> <div id="foot"> 749 S Cloverdale Ave. Los Angeles, CA 90036 </br> Sales Gallery: 999.999.9999</br> [email protected]</br> Real Estate Consulting, Sales and Marketing by <strong>Polaris Group</strong></br> a licensed California broker. DRE License # 01499250. </div> </div> </body> </html>
y este es el js que hace la validacion
Código :
$(function() { var emailreg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; $(".submit-button").click(function(){ $(".error").fadeOut().remove(); if ($(".firstname").val() == "") { $(".firstname").focus().after('<span class="error">Ingrese su nombre</span>'); return false; } if ($(".email").val() == "" || !emailreg.test($(".email").val())) { $(".email").focus().after('<span class="error">Ingrese un email correcto</span>'); return false; } if ($(".lastname").val() == "") { $(".lastname").focus().after('<span class="error">Ingrese su apellido</span>'); return false; } if ($(".zipcode").val() == "") { $(".zipcode").focus().after('<span class="error">Ingrese un zip</span>'); return false; } }); $(".firstname, .lastname, .zipcode").bind('blur keyup', function(){ if ($(this).val() != "") { $('.error').fadeOut(); return false; } }); $(".email").bind('blur keyup', function(){ if ($(".email").val() != "" && emailreg.test($(".email").val())) { $('.error').fadeOut(); return false; } }); });
muchas gracias por la ayuda!!!!!!!!