Foros aprenderaprogramar.com

Aprender a programar => Aprender a programar desde cero => Mensaje iniciado por: borri_10 en 16 de Febrero 2015, 17:04

Título: EJERCICIO CU00724B curso HTML dos formularios en una misma página web
Publicado por: borri_10 en 16 de Febrero 2015, 17:04
Código planteado como solución al ejercicio CU00724B del curso de HTML:

Código: [Seleccionar]
<html>
<head>
<meta charset="utf-8">
<title> Ejercicio CU00724B</title>
</head>
<body>
<h1>Inscripcion al curso Saber y Ganar</h1>
<form method="get" action="http://aprenderaprogramar.com">
<label for="nombre">Nombre:</label>
<input type="text" id="nombre" name="nombre">
<br/>
<label for="apellidos">Apellidos:</label>
<input type="text" name="apellidos" id="apellidos">
<br/>
<label for="email">Email:</label>
<input type="text" name="email" id="email">
<br/>
<label for="telefono">Telefono:</label>
<input type="text" name="telefono" id="telefono">
<br/>
<input type="submit" value="!Me apunto!">
<input type="reset" value="Cancelar">
<br/>
</form>
<h1>"Peticion de informacion"</h1>
<form method="get" action="http://aprenderaprogramar">
<label for="nombre">Nombre:</label>
<input type="text" id="nombre" name="nombre">
<br/>
<label for="pais">Pais:</label>
<input type="text" id="pais" name="pais">
<br/>
<label for="email">Email:</label>
<input type="text" name="email" id="email">
<br/>
Consulta;<br/>
<textarea name="comentarios" rows="3" cols="30"></textarea>
<br/>
<input type="image" name="boton1" src="http://diplomasyanuarios.com.pe/edumart/images/Contactar/boton_enviar.jpg" width="100px">
<button type="reset"> Pulse aqui para cancelar<br/> Esto borrará los datos</button>
</form>
</body>
</html>
Título: Re:EJERCICIO CU00724B curso HTML dos formularios en una misma página web
Publicado por: Alex Rodríguez en 16 de Febrero 2015, 17:31
Hola te digo las cosas a mejorar

No tienes bien escrita la url en el segundo formulario (falta el .com)

<form method="get" action="http:// aprenderaprogramar">


En un mismo html no debes tener repetido un id nunca, un id es único para cada elemento, por tanto no puedes tener id="nombre" en distintos sitios. Para solucionarlo puedes usar id="nombreForm1" para el primero e id="nombreForm2" para el segundo. Lo mismo para el email y cualquier campo, nunca repetir ids.

Saludos