Hola a todos,
Bueno ya vengo de nuevo a daros la lata con el temita. Mira que he estado probando y probando de todo y nada, no hay forma de que me salga, me cuesta más de lo que creía. Si os parece bien voy a ir indicando paso a paso todo lo que he hecho y a ver si me podéis ayudar.
Paso 1: Creación de la base de datos. He creado una tabla que se llama
inmo con los siguientes campos: id, apartamentos, zona, plazas, fotos y descripción.
Paso 2: General.asp
Es la página donde se visualizan todos los apartamentos que hay en la base de datos. Aquí hago la llamada a la tabla inmo para que me muestre los apartamentos con sus datos.
Código:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/occoninmo.asp" -->
<%
Dim Rsgeneral
Dim Rsgeneral_numRows
Set Rsgeneral = Server.CreateObject("ADODB.Recordset")
Rsgeneral.ActiveConnection = MM_occoninmo_STRING
Rsgeneral.Source = "SELECT * FROM inmo ORDER BY cint (id)"
Rsgeneral.CursorType = 0
Rsgeneral.CursorLocation = 2
Rsgeneral.LockType = 1
Rsgeneral.Open()
Rsgeneral_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
Rsgeneral_numRows = Rsgeneral_numRows + Repeat1__numRows
%>
<!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>Documento sin título</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<%
While ((Repeat1__numRows <> 0) AND (NOT Rsgeneral.EOF))
%>
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="121" rowspan="3"><div align="center">
<a href="ficha.asp?idvar=<%=(Rsgeneral.Fields.Item("id").Value)%>">
<img src="images/images_tx/<%=(Rsgeneral.Fields.Item("fotos").Value)%>" width="150" height="113" border="0" /></a></div></td>
<td> </td>
<td bgcolor="#FFFF99"><span class="Estilo6"><%=(Rsgeneral.Fields.Item("apartamentos").Value)%></span></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="19"> </td>
<td width="460"><span class="Estilo1">Plazas: <%=(Rsgeneral.Fields.Item("plazas").Value)%><br />
Zona: <%=(Rsgeneral.Fields.Item("zona").Value)%><br />
</span></td>
</tr>
<tr>
<td><div align="center"></div></td>
<td colspan="2"><div align="right"><span class="Estilo4">Disponibilidad</span></div></td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
</tr>
</table>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Rsgeneral.MoveNext()
Wend
%>
</form>
</body>
</html>
<%
Rsgeneral.Close()
Set Rsgeneral = Nothing
%>
Paso 3: Ficha.asp
Esta página muestra el apartamento que ha pinchado el usuario con una descripción amplia (Esta parte ya me funciona).
Aparte tiene que mostrar un formulario con dos desplegables. Uno de fecha de entrada y otra de salida. (es aquí donde me quedo bloqueada). Para esto en mi base de datos he creado 2 tablas, una se llama
meses (enero, febrero,…) y la otra
días (1,2,3,…). Y tiene el siguiente código:
Código:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/occoninmo.asp" -->
<%
Dim Rsficha__varid
Rsficha__varid = "1"
If (request.querystring("idvar") <> "") Then
Rsficha__varid = request.querystring("idvar")
End If
%>
<%
Dim Rsficha
Dim Rsficha_numRows
Set Rsficha = Server.CreateObject("ADODB.Recordset")
Rsficha.ActiveConnection = MM_occoninmo_STRING
Rsficha.Source = "SELECT * FROM inmo WHERE id=" + Replace(Rsficha__varid, "'", "''") + " ORDER BY cint (id)"
Rsficha.CursorType = 0
Rsficha.CursorLocation = 2
Rsficha.LockType = 1
Rsficha.Open()
Rsficha_numRows = 0
%>
<%
Dim Rsfechas
Dim Rsfechas_numRows
Set Rsfechas = Server.CreateObject("ADODB.Recordset")
Rsfechas.ActiveConnection = MM_occoninmo_STRING
Rsfechas.Source = "SELECT * FROM dias"
Rsfechas.CursorType = 0
Rsfechas.CursorLocation = 2
Rsfechas.LockType = 1
Rsfechas.Open()
Rsfechas_numRows = 0
%>
<%
Dim Rsfechas2
Dim Rsfechas2_numRows
Set Rsfechas2 = Server.CreateObject("ADODB.Recordset")
Rsfechas2.ActiveConnection = MM_occoninmo_STRING
Rsfechas2.Source = "SELECT * FROM meses"
Rsfechas2.CursorType = 0
Rsfechas2.CursorLocation = 2
Rsfechas2.LockType = 1
Rsfechas2.Open()
Rsfechas2_numRows = 0
%>
<!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>Documento sin título</title>
<style type="text/css">
<!--
.Estilo1 {
font-size: 12px;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
}
.Estilo3 {color: #003399}
-->
</style>
<script type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>
<body>
<table width="722" border="0" cellspacing="0" cellpadding="0">
<!--DWLayoutTable-->
<tr>
<td height="227" colspan="2" valign="top"><img src="images/images_tx/<%=(Rsficha.Fields.Item("fotos").Value)%>" width="300" height="225" border="1" /></a></td>
<td valign="top" bgcolor="#FFFFCC"><div align="center"></div></td>
<td valign="top" bgcolor="#FFFFCC"><div align="center"><span class="Estilo1"><br />
<%=(Rsficha.Fields.Item("Descripcion").Value)%></span></div></td>
</tr>
<tr>
<td width="146" height="19"><!--DWLayoutEmptyCell--> </td>
<td width="156"> </td>
<td width="4"> </td>
<td width="416"><div align="center"></div></td>
</tr>
<tr>
<td height="15" bgcolor="#FFCC00"><div align="center" class="Estilo1"><a href="general.asp">volver</a></div></td>
<td height="15" colspan="2"><div align="center"></div></td>
<td height="15"><div align="center" class="Estilo1 Estilo3" onclick="MM_openBrWindow('calendario.asp','','width=180,height=180')"><a href="#">disponibilidad</a></div></td>
</tr>
</table>
<p><span class="Estilo1">Selecciona las fechas que deseas reservar este apartamento :</span></p>
<form id="form2" name="form2" method="post" action="">
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="115" class="Estilo1">Fecha de entrada: </td>
<td width="42"><label>
<select name="txtdiaentra">
<%
While (NOT Rsfechas.EOF)
%>
<option value="<%=(Rsfechas.Fields.Item("dias").Value)%>" ><%=(Rsfechas.Fields.Item("dias").Value)%></option>
<%
Rsfechas.MoveNext()
Wend
If (Rsfechas.CursorType > 0) Then
Rsfechas.MoveFirst
Else
Rsfechas.Requery
End If
%>
</select>
</label></td>
<td width="29"> </td>
<td width="214">
<select name="txtmesentra">
<%
While (NOT Rsfechas2.EOF)
%>
<option value="<%=(Rsfechas2.Fields.Item("meses").Value)%>" ><%=(Rsfechas2.Fields.Item("meses").Value)%></option>
<%
Rsfechas2.MoveNext()
Wend
If (Rsfechas2.CursorType > 0) Then
Rsfechas2.MoveFirst
Else
Rsfechas2.Requery
End If
%>
</select> </td>
</tr>
<tr>
<td> </td>
<td colspan="3"> </td>
</tr>
<tr>
<td class="Estilo1">Fecha de salida : </td>
<td>
<select name="txtdiasalida" id="txtdiasalida">
<%
While (NOT Rsfechas.EOF)
%>
<option value="<%=(Rsfechas.Fields.Item("dias").Value)%>" ><%=(Rsfechas.Fields.Item("dias").Value)%></option>
<%
Rsfechas.MoveNext()
Wend
If (Rsfechas.CursorType > 0) Then
Rsfechas.MoveFirst
Else
Rsfechas.Requery
End If
%>
</select></td>
<td> </td>
<td>
<select name="txtmesalida">
<%
While (NOT Rsfechas2.EOF)
%>
<option value="<%=(Rsfechas2.Fields.Item("meses").Value)%>" ><%=(Rsfechas2.Fields.Item("meses").Value)%></option>
<%
Rsfechas2.MoveNext()
Wend
If (Rsfechas2.CursorType > 0) Then
Rsfechas2.MoveFirst
Else
Rsfechas2.Requery
End If
%>
</select></td>
</tr>
<tr>
<td> </td>
<td colspan="3"> </td>
</tr>
<tr>
<td> </td>
<td colspan="3"><label>
<input type="submit" name="Submit" value="Enviar" />
</label></td>
</tr>
</table>
</form>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</body>
</html>
<%
Rsficha.Close()
Set Rsficha = Nothing
%>
<%
Rsfechas.Close()
Set Rsfechas = Nothing
%>
<%
Rsfechas2.Close()
Set Rsfechas2 = Nothing
%>
De momento he llegado hasta aquí. Así que como veis no he conseguido hacer gran cosa y todavía me falta el tema del calendario. Bueno, os pido otra vez y lo siento que me ayudéis y a ver si esta vez lo consigo poco a poco.
Muchas gracias por todo,
Itxaso