![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
15/06/2006, 03:18
|
![Avatar de yournightmare86](http://static.forosdelweb.com/customavatars/avatar135773_1.gif) | | | Fecha de Ingreso: abril-2006 Ubicación: Madrid
Mensajes: 875
Antigüedad: 18 años, 9 meses Puntos: 9 | |
Este el archivo form.html que muestra un formulario.
<html>
<head>
<title>PRACTICA 1</title>
</head>
Practica 1
<form action="form.asp" method="POST">
<p>
<br>usuario(*): <input type="text" name="user">
<br>clave(*): <input type="text" name="psw">
<br>Dirección: <input type="text" name="address">
<br>Ciudad: <input type="text" name="city">
<br>Estado: <input type="text" name="state">
<br>Código Postal: <input type="text" name="zip">
<p><input type="submit" name="enviar">
<p><input type="reset" name="reset">
</form>
</body>
</html>
Y éste es el form.asp, que es un script escrito en lenguaje ASP que genera html dinámico respondiendo en función de lo que se haya escrito en el formulario.
<%@LANGUAGE="VBSCRIPT"%>
<%Option Explicit%>
<HTML>
<HEAD>
<TITLE>Form PHP</TITLE>
</HEAD>
<BODY>
<div align="center">
nombre: <% =Request.Form("user") %>
<% dim a
a=5 %>
<% Response.write a %>
<br>
<% a = Request.Servervariables("request_method") %>
<% Response.Write a %>
<p><strong>Coleccion Request.Form</strong>
<p>
<%
Dim item
FOR EACH item IN Request.Form %>
<% Response.write item%> : <% Response.Write Request.Form(item) %><br>
<% NEXT %>
<%
' Preparar las variables
Dim SQL
Dim ObjetoConexion
Dim Rs
SQL = "SELECT * FROM usuarios ORDER BY Nombre"
' Preparar la conexion
SET ObjetoConexion = Server.CreateObject("ADODB.Connection")
ObjetoConexion.Open "Provider=Microsoft.Jet.OLEDB.4.0;data source=c:\tmp\bd.mdb"
SET Rs = ObjetoConexion.Execute(SQL)
'Salida de los registros con name Nombre
%>
<table width="200" border="1">
<%
While not Rs.EOF
response.write("<tr>")
response.write("<td>")
response.Write(Rs("Nombre"))
response.write(" </td>")
Response.Write("<td>")
Response.Write(Rs("Clave"))
Response.Write(" </td>")
Response.Write("<td>")
Response.Write(Rs("Ciudad"))
Response.Write(" </td>")
Response.write("</tr>")
Rs.MoveNext
Wend
%>
</table>
<%
' Cerrar conexion y organizar memoria
ObjetoConexion.Close
SET ObjetoConexion = Nothing
%>
<p>
<p>
</div>
</BODY>
</HTML>
En éste caso se geenra un formulario con 2 campos obligatorios(usuario y clave) y otros opcionales como ciudad estado dirrecion codigo postal... Tendrías que tener esos 2 ficheros en un servidor web que admitiera ASP.NET. No sé si entenderás o no... espero que te ayude. Es lo único que se me ocurrió. Un saludo. |