Foros del Web » Creando para Internet » HTML »

formulario de contacto error usuario siempre

Estas en el tema de formulario de contacto error usuario siempre en el foro de HTML en Foros del Web. Hola amigos, soy nuevo en el foro y pues me he registrado pues he visto que verdaderamente ayudan con problemitas como el que tengo. Bueno ...
  #1 (permalink)  
Antiguo 19/03/2011, 12:41
 
Fecha de Ingreso: marzo-2011
Mensajes: 2
Antigüedad: 13 años, 1 mes
Puntos: 0
Pregunta formulario de contacto error usuario siempre

Hola amigos, soy nuevo en el foro y pues me he registrado pues he visto que verdaderamente ayudan con problemitas como el que tengo.

Bueno mi caso es que mi página web la rediseñe y ya la monte y pues esta funcionando muy bien, pero el problema es con el formulario de contacto, siempre me tira el error de "username" o nombre como yo lo modifique, pues estabasado en otro formulario. sin embargo solo modifique los textos que tiran los errores y los campos de entrada, para que no dijera name o message sino nombre y mensaje. En fin les dejo aqui el html, send.php, contact.js.

HTML
Código HTML:
<!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>
<title>Alexei Prada Nagai | Portafolio Web</title>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" href="style.css" type="text/css" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
	 

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="contact.js"></script>
<script src="../../Scripts/swfobject_modified.js" type="text/javascript"></script>
<style type="text/css">
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
</style>
</head>
<body>

<div id="wrapper">

<div id="header_wrap">
  <div id="header">

</div>

</div>
<div id="main">
<div id="portfolio"> 
  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1000" height="650" id="FlashID" title="Portafolio">
    <param name="movie" value="preloader.swf" />
    <param name="quality" value="high" />
    <param name="wmode" value="opaque" />
    <param name="swfversion" value="6.0.65.0" />
    <!-- Esta etiqueta param indica a los usuarios de Flash Player 6.0 r65 o posterior que descarguen la versión más reciente de Flash Player. Elimínela si no desea que los usuarios vean el mensaje. -->
    <param name="expressinstall" value="../../Scripts/expressInstall.swf" />
    <!-- La siguiente etiqueta object es para navegadores distintos de IE. Ocúltela a IE mediante IECC. -->
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="preloader.swf" width="1000" height="650">
      <!--<![endif]-->
      <param name="quality" value="high" />
      <param name="wmode" value="opaque" />
      <param name="swfversion" value="6.0.65.0" />
      <param name="expressinstall" value="../../Scripts/expressInstall.swf" />
      <!-- El navegador muestra el siguiente contenido alternativo para usuarios con Flash Player 6.0 o versiones anteriores. -->
      <div>
        <h4>El contenido de esta página requiere una versión más reciente de Adobe Flash Player.</h4>
        <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Obtener Adobe Flash Player" width="112" height="33" /></a></p>
      </div>
      <!--[if !IE]>-->
    </object>
    <!--<![endif]-->
  </object>
</div>
<div id="quotes">
<div id="intro">
</div>
<div id="quote1">
<p> 	
"La mirada llega primero que las palabras. Los niños miran y reconocen las cosas antes de poder hablar" </p>

<h2> — John Berger, Modos de Ver </h2>
 

</div>
<div id="quote2">
<p>
"El diseño es la inteligencia hecha visible"</p>
<h2> — Alina Wheeler </h2>
<p> "Menos es más" </p>
<h2> — Robert Browning</h2>

</div>


<div id="container">

<p> <a class="modal" href="#"><img src="Images/contact_box.png" style="border-style: none" alt="Contact" width="300" height="272" /></a>.</p>


</div>

</div>

</div>
<div id="contact">

<div id="social">
<div id="email2">
  <h3> Email </h3>
  <p>[email protected]</p>
  <h3>Redes Sociales</h3>
  <p><a href="http://www.facebook.com/alexei.nagai" target="_blank"><img src="Images/FB.png" width="42" height="42"style="border-style: none" alt="Facebook" /></a> <a href="http://twitter.com/#!/AlekseyNa" target="_blank"><img src="Images/twit.png" width="42" height="42"style="border-style: none" alt="Twitter" /></a></p>
  </div>
</div>

 <div id="close"></div>
	 
      
 <div id="contact_header"></div>
 <p class="success">Gracias! Tue mensaje ha sido enviado.</p>
	 
 <form action="send.php" method="post" name="contactForm" id="contactForm">
 <p><input name="name" id="name" type="text" size="30" value="Nombre" /></p>
 <p><input name="email" id="email" type="text" size="30" value="Email" /></p>
 <p><textarea name="comment" id="comment" rows="5" cols="40">Mensaje</textarea></p>
 <p><input type="submit" id="submit" name="submit" value="" /></p>
 </form>
</div>
	 
<div id="mask"></div>

<div id="footer_wrap">

<div id="footer">

<p> Copyright © 2011 | Alexei Prada Nagai</p>


</div>
</div>
</div>
</body>

</html> 

contact.js
Código:
$(function() {

	// load the modal window
	$('a.modal').click(function(){

		// scroll to top
		$('html, body').animate({scrollTop:0}, 'slow');

		// before showing the modal window, reset the form incase of previous use.
		$('.success, .error').hide();
		$('form#contactForm').show();
		
		// Reset all the default values in the form fields
		$('#name').val('Nombre');
		$('#email').val('Email');
		$('#comment').val('Mensaje');

		//show the mask and contact divs
		$('#mask').show().fadeTo('', 0.7);
		$('div#contact').fadeIn();

		// stop the modal link from doing its default action
		return false;
	});

	// close the modal window is close div or mask div are clicked.
	$('div#close, div#mask').click(function() {
		$('div#contact, div#mask').stop().fadeOut('slow');

	});

	$('#contactForm input').focus(function() {
		$(this).val(' ');
	});
	
	$('#contactForm textarea').focus(function() {
        $(this).val('');
    });

	// when the Submit button is clicked...
	$('input#submit').click(function() {
	$('.error').hide().remove();
		//Inputed Strings
		var username = $('#name').val(),
			email = $('#email').val(),
			comment = $('#comment').val();
		
	
		//Error Count
		var error_count;
		
		//Regex Strings
		var username_regex = /^[a-z0-9_-]{3,16}$/,
			email_regex = /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/;
		
			//Test Username
			if(!username_regex.test(name)) {
				$('#contact_header').after('<p class=error>Por favor introduce tu nombre</p>');
				error_count += 1;
			}
			
			//Test Email
			if(!email_regex.test(email)) {
				$('#contact_header').after('<p class=error>introduce un correo valido</p>');
				error_count += 1;
			}
			
			//Blank Comment?
			if(comment == '') {
				$('#contact_header').after('<p class=error>No No has escrito ningun mensaje</p>');
				error_count += 1;
			}
			
			//No Errors?
			if(error_count === 0) {
				$.ajax({
					type: "post",
					url: "send.php",
					data: "name=" + name + "&email=" + email + "&comment=" + comment,
					error: function() {
						$('.error').hide();
						$('#sendError').slideDown('slow');
					},
					success: function () {
						$('.error').hide();
						$('.success').slideDown('slow');
						$('form#contactForm').fadeOut('slow');
					}				
				});	
			}
			
			else {
                $('.error').show();
            }
			
		return false;
	});
	
});
Ok espero me puedan ayudar
  #2 (permalink)  
Antiguo 19/03/2011, 12:44
 
Fecha de Ingreso: marzo-2011
Mensajes: 2
Antigüedad: 13 años, 1 mes
Puntos: 0
formulario de contacto error usuario siempre

Perdon por el doble post pero no me cupo todo el codigo xD

el send.php
Código PHP:
<?php

//Prefedined Variables
$to "[email protected]";
$subject "Contact from your website.";

if(
$_POST) {
    
// Collect POST data from form
    
$name stripslashes($_POST['name']);
    
$email stripslashes($_POST['email']);
    
$comment stripslashes($_POST['comment']);

    
// Define email variables
    
$message date('d/m/Y')."\n" $name " (" $email ") sent the following comment:\n" $comment;
    
$headers 'From: '.$email.'\r\n\'Reply-To: ' $email '\r\n\'X-Mailer: PHP/' phpversion();
    
    
//Validate
    
$header_injections preg_match("(\r|\n)(to:|from:|cc:|bcc:)"$comment);
    
    if( ! empty(
$name) && ! empty($email) && ! empty($comment) && ! $header_injections ) {
        if( 
mail($to$subject$message$headers) ) {
            return 
true;
        }
        else {
            return 
false;
        }
    }
    else {
        return 
false;
    }
}
?>
y dejo el CSS por si hace falta

CSS

Código CSS:
Ver original
  1. /* CSS Document */
  2.  
  3. body {
  4. margin:0px;
  5. padding: 0px;
  6. }
  7.  
  8. #wrapper {
  9. width: 100%;
  10. margin-top: 0px;
  11. margin:auto;
  12. background: url(Images/bgwrap.jpg);
  13.  
  14. }
  15.  
  16. #header_wrap{
  17.     position: relative;
  18.     width: 100%;
  19.     height:200px;
  20.     margin:auto;
  21.     background-image: url(Images/bkgd.png);
  22.     background-repeat: repeat-x;
  23.     background-position:center center;
  24. }
  25.  
  26. #header{
  27.     width:1100px;
  28.     height:200px;
  29.     margin:auto;
  30.     background-image: url(Images/alexei.png);
  31.     background-repeat: no-repeat;
  32.     background-position: center center;
  33. }
  34.  
  35. #main {
  36. width:1100px;
  37. margin:auto;
  38. overflow:hidden;
  39. clear:none;
  40.  
  41. }
  42.      #portfolio{
  43.     width:1000px;
  44.     height:650px;
  45.     margin:auto;
  46.    
  47.     }
  48.  
  49.     #quotes{
  50.     height:350px;
  51.     width:1100px;
  52.     margin:auto;
  53.         }
  54.  
  55.         #intro {
  56.         width:1100px;
  57.         height:25px;
  58.        
  59.         }
  60.         #quote1{
  61.     float:left;
  62.     width:300px;
  63.     height:300px;
  64.     margin-bottom:25px;
  65.     margin-left:50px;
  66.    
  67.        
  68.         }
  69.  
  70.         #quote2{
  71.     float:left;
  72.     width:300px;
  73.     height:300px;
  74.     margin-bottom:25px;
  75.     margin-left:50px;
  76.    
  77.        
  78.         }
  79.  
  80.        
  81.         #quote1 p{
  82.             font-family:"garamond", "Times New Roman", Times, serif;
  83.             font-style:italic;
  84.             padding: 20px;
  85.             font-size:25px;
  86.             margin-top:0;
  87.                        
  88.             }
  89.            
  90.         #quote2 p{
  91.             font-family:"garamond", "Times New Roman", Times, serif;
  92.             font-style:italic;
  93.             padding: 20px;
  94.             font-size:25px;
  95.             margin-top:0;
  96.                        
  97.             }
  98.            
  99.         #quote3 p{
  100.             font-family: "calibri", Arial, Helvetica, sans-serif;  
  101.             font-size:15px;
  102.             margin-top:0;
  103.             text-align:right;
  104.                        
  105.             }
  106.            
  107.         #quotes h2{
  108.             font-family:  "calibri", Verdana, Geneva, sans-serif;
  109.             font-size:20px;
  110.             padding:10px;
  111.             color: #003366;
  112.             text-shadow: 0px 2px 1px white;
  113.             margin-top:0;
  114.             line-height:2px;
  115.             text-align:right;
  116.            
  117.             }
  118.        
  119.     #footer_wrap{
  120.     background-image: url(Images/footerbg.png);
  121.     background-repeat: repeat-x;
  122.     background-position:center center;
  123.     height:250px;
  124.     width:100%;
  125.     line-height:2em;
  126.    
  127.     }
  128.  
  129.         #footer{
  130.         height:100px;
  131.         width:1100px;
  132.         margin:auto;
  133.        
  134. }
  135.             #footer p{
  136.             font-family:helvetica, arial, verdana, sans-serif;
  137.             font-size:12px;
  138.             text-align:center;
  139.             color:white;
  140.             margin-top:0;
  141.             padding-top:15px;
  142.             text-shadow: 0px 2px 1px black;
  143.  
  144.  
  145.  
  146. }
  147. /* CSS Contact Form */
  148.  
  149. #container {
  150.     float:left;
  151.     width:300px;
  152.     height:300px;
  153.     margin-bottom:25px;
  154.     margin-left:50px;
  155.     border:none;
  156.    
  157.     }
  158.      
  159.     /*contact form*/
  160.     #mask {
  161.     background-color:#000;
  162.     display:none;
  163.     left:0;
  164.     position:absolute;
  165.     top:0;
  166.     width:100%;
  167.     height:1450px;
  168.     z-index:9000;
  169.     }
  170.      
  171.     #contact {
  172.     background:url(Images/bgwrap.jpg);
  173.     display:none;
  174.     left:50%;
  175.     margin-left:-300px;
  176.     position:absolute;
  177.     top:90px;
  178.     width:600px;
  179.     z-index:9999;
  180.     border-radius:10px;
  181.     -moz-border-radius:10px;
  182.     -webkit-border-radius:10px;
  183.     padding:20px 20px 0px;
  184.     }
  185.     #social {
  186.     width:200px;
  187.     position:absolute;
  188.     left:370px;
  189.     top:120px;
  190.     padding-left:30px;
  191.     border-left: 2px solid #663333;
  192.     border-radius:10px;
  193.     -moz-border-radius:10px;
  194.     -webkit-border-radius:10px;
  195. }
  196. #email2 {
  197.     font-family: Verdana, Geneva, sans-serif;
  198.     font-size:10pt;
  199.     font-style:italic;
  200.     text-align:left;
  201.     color: #663333;
  202.     }
  203. #email2 h3 {
  204.     font-family: "Courier New", Courier, monospace;
  205.     font-size:14pt;
  206.     font-style:normal;
  207.    
  208.     }
  209.  
  210.      
  211.     #close {
  212.     background:url(Images/close.png) no-repeat right;
  213.     cursor:pointer;
  214.     height:24px;
  215.     width:24px;
  216.     position:relative;
  217.     left:605px;
  218.     bottom:30px;
  219.     }
  220.      
  221.     #contact_header {
  222.     background:url(Images/contact_header.png) no-repeat left;
  223.     font-family:arial, sans-serif;
  224.     font-size:30px;
  225.     font-weight:700;
  226.     line-height:50px;
  227.     padding:5px 5px 10px 60px;
  228.     height:40px;
  229.     }
  230.      
  231.     /* form components */
  232.     input,textarea {
  233.     border:1px solid silver;
  234.     background-color:#fff;
  235.     color:#404040;
  236.     font-size:10px;
  237.     font-family:Verdana, Arial, sans-serif;
  238.     text-transform:regular;
  239.     border-radius:5px;
  240.     -moz-border-radius:5px;
  241.     -webkit-border-radius:5px;
  242.     margin:10px 0;
  243.     padding:10px;
  244.     }
  245.      
  246.     input:hover[type=text],input:focus[type=text],textarea:hover,textarea:focus {
  247.     background-color:#E0E0E0;
  248.     border:1px solid #000;
  249.     }
  250.      
  251.     input[type=text],textarea {
  252.     width:300px;
  253.     }
  254.      
  255.     #submit {
  256.     border:none;
  257.     width:181px;
  258.     height:54px;
  259.     background:url(Images/submit.png);
  260.     }
  261.      
  262.     #submit:hover {
  263.     cursor:pointer;
  264.     }
  265.      
  266.     /* alert messages */
  267.     .success,.error {
  268.     color:#000;
  269.     display:none;
  270.     font-size:15px;
  271.     font-weight:700;
  272.     border-radius:4px;
  273.     -moz-border-radius:4px;
  274.     -webkit-border-radius:4px;
  275.     padding:5px 10px 5px 10px;
  276.     margin-bottom: 10px;
  277.     }
  278.      
  279.     .success {
  280.     background-color:#9F6;
  281.     border:1px solid #0F0;
  282.     width:300px;
  283.     }
  284.      
  285. .error {
  286. background-color:#F66;
  287. border:1px solid red;
  288. width:300px;
  289.  
  290. }

Etiquetas: contact, css, js, php, 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 08:20.