Foros del Web » Programando para Internet » PHP »

include

Estas en el tema de include en el foro de PHP en Foros del Web. Hola ... Estoy empezando en php y tengo el siguiente problema ... Tengo un php como plantilla y utilizo include para cambiar solo parte de ...
  #1 (permalink)  
Antiguo 19/04/2003, 12:00
 
Fecha de Ingreso: febrero-2003
Mensajes: 165
Antigüedad: 21 años, 2 meses
Puntos: 0
include

Hola ...

Estoy empezando en php y tengo el siguiente problema ...

Tengo un php como plantilla y utilizo include para cambiar solo parte de la página. Pero solo toma el valor por defecto no los otros valores. Aquí le paso el código...

Gracias

//inicio de código
<body marginwidth="0" marginheight="0" rightmargin="0" leftmargin="0" bottommargin="0" topmargin="0" height=550 width=800>
<table width="100%" border="0" bgcolor="#00CCFF">
<tr>
<td>
<table width="100%" border="0">
<tr>
<td align="left" valign="top"><img src="images/logoCubaTropical.gif"></td>
<td align="left" valign="top"><img src="images/txtslogan.gif"></td>
</tr>
</table></td>
<td width="360">&nbsp;</td>
</tr>
</table>
<table width="100%" bgcolor="#33FF99" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td width="20%" align="left" valign="middle"><a class="Tabs" href="mailto:[email protected]">&nbsp;&nbsp;Con tact us</a></td>
<td width="80%">
</td>
</tr>
</table>

<table width="100%" height="737" border="0" bgcolor="#FFFFCF">
<tr>
<td width="20%" height="731"><table width="100%" height="725" border="0">
<tr>
<td height="280"><font class="CurrentPage">Journey to the Pearl of Antilles &quot;Cuba&quot; ,the
most safe country in the world.<br><br> Experience warm hospitality of Cuban
people, explore the Old Havana, swim in world-famous beaches as Varadero,
dance your way in the country of rumba, mambo, cha-cha-cha and salsa. <br><br>
Go freely throughout its cities, valleys, mountains, beaches and waterfalls. <br><br>
Return to your country tanned, refreshed and relaxed. </font></td>
</tr>
<tr>
<td height="437">&nbsp;</td>
</tr>
</table></td>
<td width="60%" align="center" valign="top">
<?
$id=$_GET['id'];
switch ($id) {
case 1:
include("hoteles_home.inc");
break;
case 2:
include("excur_home.inc");
break;
case 3:
include("prog_home.inc");
break;
default:
include("hoteles_home.inc");

// estado default .. nos determina el estado
// "si no es ninguna opcion de las anteriores".
}
?>

</td>
<td width="20%">&nbsp;</td>
</tr>
</table>

</body>
//fin codigo

//include hoteles_home.inc
<link rel="stylesheet" href="jscss/sty.css" type="text/css">
<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>Hoteles</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">Excursiones</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">Programas</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>
<tr><td width="137">
<font class="CurrentPage"> Nombre del Hotel</font>
</td>
<td width="197">
<select name="nhotel">
<option>Habana Libre</option>
<option>Riviera</option>
<option>Mellia Cohiba</option>
</select>
</td>
<tr>
<td>
<font class="CurrentPage">Destino</font>
</td>
<td>
<select name="ndestino">
<option>Varadero</option>
<option>Santiago de Cuba</option>
<option>La Habana</option></select>
</td>
</tr>
</table>
</td>
</tr>
</Table>
</form>
  #2 (permalink)  
Antiguo 19/04/2003, 12:54
Avatar de lado2mx
Colaborador
 
Fecha de Ingreso: agosto-2001
Ubicación: Veracruz
Mensajes: 3.720
Antigüedad: 22 años, 8 meses
Puntos: 9
es facil:
solo cambia:

Código PHP:
<?
$id
=$_GET['id'];
// a:
$id=$HTTP_GET_VARS['id'];?>
Lo mas probable, es que $_GET; no lo detecta el PHP que tienes en tu PHP, tal vez sea una versión 4.0, de 4.1 en adelante detecta el $_GET;
  #3 (permalink)  
Antiguo 19/04/2003, 12:54
O_O
 
Fecha de Ingreso: enero-2002
Ubicación: Santiago - Chile
Mensajes: 34.417
Antigüedad: 22 años, 3 meses
Puntos: 129
Usa:

case '1':

(entrecomillado .. Aunque PHP suele convertir los tipos de variables)

Y si haces un:
echo $id;

Justo despues de $id=$_GET['id]; podrás ver si toma el valor esperado ..

Y bueno .. ya sabras que tienes que llamar a tus páginas via:
nose.php?id=1 .. o el nº de la sección que corresponda.

Un saludo,
__________________
Por motivos personales ya no puedo estar con Uds. Fue grato haber compartido todos estos años. Igualmente los seguiré leyendo.
  #4 (permalink)  
Antiguo 19/04/2003, 14:30
 
Fecha de Ingreso: febrero-2003
Mensajes: 165
Antigüedad: 21 años, 2 meses
Puntos: 0
mil gracias lad2mx... ya funciona..
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 16:31.