Hola...
Tengo un control <select llenado desde una base de datos y necesito que en evento onChange pasar el valor seleccionado a otra página .php.
El códig que le envío no pasa el valor correcto. Me devuelve la cadana:
'this.options[this.selectedIndex].value'
literalmente.
Gracias
<link rel="stylesheet" href="jscss/sty.css" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<Table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<TABLE width="200" cellSpacing=0 cellPadding=0 border="0">
<TBODY>
<TR>
<TD><IMG src="images/tabs_active_left.gif" alt="" width=10 height=22 border=0></TD>
<TD class=ActiveTab rowSpan=2><A class=ActiveTab>Hotels</A></TD>
<TD><IMG height=22 alt="" src="images/tabs_active_right.gif" width=10 border=0></TD>
<TD><IMG height=22 alt="" src="images/tabs_inact_left.gif" width=10 border=0></TD>
<TD class=InactiveTab><A class=Tabs href="index.php?id=2">Excursions</A></TD>
<TD><IMG height=22 alt="" src="images/tabs_inact_right.gif" width=10 border=0></TD>
<TD><IMG height=22 alt="" src="images/tabs_inact_left.gif" width=10 border=0></TD>
<TD class=InactiveTab><A class=Tabs href="index.php?id=3">Packages</A></TD>
<TD><IMG height=22 alt="" src="images/tabs_inact_right.gif" width=10 border=0></TD>
</TR>
</TBODY>
</TABLE>
</td>
</tr>
<tr class="ActiveTab">
<td>
<table width="322" border="0" cellpadding="2" cellspacing="2">
<tr>
<td align="right"><font class="CurrentPage">Search</font></td>
<td></td>
</tr>
<tr align="center">
<td width="103" align="right"><font class="cadena">Hotel</font>
</td>
<td width="209" align="left">
<?
$conn = odbc_connect("bdctt", "", "");
$query = odbc_exec($conn, "select codihote, nombhote from thote order by 2");
$cont01 = 0;
while(odbc_fetch_row($query))
{
$do_codihote[$cont01] = odbc_result($query,"codihote");
$do_nombhote[$cont01] = odbc_result($query,"nombhote");
$cont01++;
}
echo "<form name='form1' method='post' action='' >";
?>
<select name="custid" id="custid" onChange="form.action='prueba.php?id=this.options[this.selectedIndex].value';form.submit();">
<? $a = 0; ?>
<option>-seleccione un hotel-</option>
<? while ( ($cont01) <> $a) { ?>
<option value=<? echo $do_nombhote[$a]?>> <? echo $do_nombhote[$a]?> </option>
<? $a++ ; }
odbc_close_all; ?>
</select>
</td>
</tr>
<tr>
<td align="right"><font class="cadena">Destination/Category</font>
</td>
<td><select name="ndestino" class="cadena">
<option>HAVANA/5 stars</option>
<option>HAVANA/4 stars</option>
<option>HAVANA/3 stars</option>
<option>BEACHES/5 stars</option>
<option>BEACHES/4 stars</option>
<option>BEACHES/3 stars</option>
<option>OTHER CITIES/5 stars</option>
<option>OTHER CITIES/4 stars</option>
<option>OTHER CITIES/3 stars</option>
</select>
</td>
</tr>
<? echo "</form>" ?>
</table>
<hr>
<?
$id_hoteles=$HTTP_GET_VARS['id_hoteles_searchs'];
switch ($id_hoteles) {
case 1:
include("hoteles_items.php");
break;
case 2:
include("Hoteles_Description.php");
break;
default:
include("hoteles_items.php");
// estado default .. nos determina el estado
// "si no es ninguna opcion de las anteriores".
}
?>
</td>
</tr>
</Table>