Ver Mensaje Individual
  #21 (permalink)  
Antiguo 22/08/2012, 09:57
Avatar de Nemutagk
Nemutagk
Colaborador
 
Fecha de Ingreso: marzo-2004
Ubicación: México
Mensajes: 2.633
Antigüedad: 20 años, 1 mes
Puntos: 406
Respuesta: Mostrar variable de sesion que es un array

Para que se entienda mas facil, con for es mas facil cometer "errores" al recorrer un array, aparte que no tiene mucho sentido, para eso es mucho mejor usar foreach...

Código PHP:
Ver original
  1. //tu código...
  2. $numHab = count($tipo_habitacion_c);
  3.       for($i=0; $i<=$numHab; $i++){
  4.                 $tipo_habitacion_c[$i];
  5.            
  6.             echo '<td>'.$tipo_habitacion_c[$i];'</td>';
  7.             echo '<input type="hidden" name="tipo_habitacion_c[]" value="'.$tipo_habitacion_c[$i].'">';
  8.       }
  9.  
  10. //con foreach
  11. foreach($tipo_habitacion_c as $habitacion) {
  12.             echo '<td>'.$habitacion;'</td>';
  13.             echo '<input type="hidden" name="tipo_habitacion_c[]" value="'.$habitacion.'">';
  14. }
__________________
Listo?, tendría que tener 60 puntos menos de IQ para considerarme listo!!!
-- Sheldon Cooper
http://twitter.com/nemutagk
PD: No contestaré temas vía mensaje personal =)