Foros del Web » Programando para Internet » PHP »

boton mostrar

Estas en el tema de boton mostrar en el foro de PHP en Foros del Web. @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código PHP: Ver original <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="javascript" type="text/javascript"> function getXMLHTTP()         {     ...
  #1 (permalink)  
Antiguo 16/06/2011, 10:04
Avatar de HerbyBocho  
Fecha de Ingreso: mayo-2011
Ubicación: Chihuahua, Chihuahua, Mexico
Mensajes: 52
Antigüedad: 12 años, 10 meses
Puntos: 1
boton mostrar

Código PHP:
Ver original
  1. <html>
  2. <head>
  3. <title></title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  5. <script language="javascript" type="text/javascript">
  6. function getXMLHTTP()
  7.         {
  8.         var xmlhttp=false; 
  9.             try
  10.                 {
  11.                     xmlhttp=new XMLHttpRequest();
  12.                 }
  13.                 catch(e)   
  14.                 {      
  15.                     try
  16.                     {          
  17.                         xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
  18.                     }
  19.                     catch(e)
  20.                     {
  21.                         try
  22.                         {
  23.                             xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  24.                         }
  25.                         catch(e1)
  26.                         {
  27.                         xmlhttp=false;
  28.                         }
  29.                     }
  30.                 }      
  31.         return xmlhttp;
  32.         }
  33.         function getState(countryId)
  34.         {      
  35.         var strURL="findState.php?country="+countryId;
  36.         var req = getXMLHTTP();
  37.         if (req)
  38.             {
  39.             req.onreadystatechange = function()
  40.                 {
  41.                     if (req.readyState == 4)
  42.                         {
  43.                             if (req.status == 200)
  44.                             {                      
  45.                                 document.getElementById('statediv').innerHTML=req.responseText;                    
  46.                             }
  47.                             else
  48.                             {
  49.                             alert("There was a problem while using XMLHTTP:\n" + req.statusText);
  50.                             }
  51.                         }              
  52.                 }          
  53.             req.open("GET", strURL, true);
  54.             req.send(null);
  55.         }      
  56.     }
  57.     function getCity(countryId,stateId)
  58.     {      
  59.         var strURL="findCity.php?country="+countryId+"&state="+stateId;
  60.         var req = getXMLHTTP();
  61.         if (req)
  62.         {
  63.         req.onreadystatechange = function()
  64.             {
  65.                 if (req.readyState == 4)
  66.                     {
  67.                         if (req.status == 200)
  68.                             {                      
  69.                                 document.getElementById('citydiv').innerHTML=req.responseText;                     
  70.                             }
  71.                             else
  72.                             {
  73.                                 alert("There was a problem while using XMLHTTP:\n" + req.statusText);
  74.                             }
  75.                     }              
  76.             }          
  77.             req.open("GET", strURL, true);
  78.             req.send(null);
  79.         }          
  80.     }
  81. </script>
  82. </head>
  83. <body>
  84. <form action="asistencias_calificaciones.php" method="post">
  85. <img align="right" src="logo proyecto.jpg" width="500" height="200">
  86. <?php
  87. include_once ("clase.php");
  88.     $finicio="";
  89.     $estado="";
  90.     $municipio="";
  91. ?>
  92. <table width="378" height="219" border=4>
  93.   <tr>
  94.     <td width="150">Estado</td>
  95.     <td  width="150"><select name="country" onChange="getState(this.value)">
  96.     <option value="">Selecciona Estado</option>
  97. <?php
  98.     $estado=new Estados();
  99.     $estado= $estado->getEstado();
  100.     while ($row=mysql_fetch_array($estado))
  101. print '<option value='.$row['Id_Estados'].'>'.$row['Estado'].'</option>' ;
  102.     ?> </select>
  103.   </td>
  104.   </tr>
  105.   <tr>
  106.     <td>Municipio</td>
  107.     <td ><div id="statediv"><select name="state">
  108.     <option>Selecciona estado primero</option>
  109.         </select></div>
  110.   </td>
  111.   </tr>
  112.   <tr>
  113.     <td>Fecha de Inicio</td>
  114.     <td ><div id="citydiv"><select name="city">
  115.     <option>Seleccciona municipio primero</option>
  116.         </select></div>
  117.   </td>
  118.   </tr>
  119. </table>
  120. <br>
  121. <input type="submit" name="MOSTRAR" value="MOSTRAR">
  122. <?php
  123. if($_POST['MOSTRAR']=='MOSTRAR')
  124. {
  125. $usuario=new Usuario();
  126. print_r($_POST);
  127. $usuario= $usuario->getByDate($_POST['state'],$_POST['country'],$_POST['city']);
  128. echo '<br/><br/><table border=4>'
  129.           .'<tr><td>Nombre</td>'
  130.           .'<td>s1</td>'
  131.           .'<td>d2</td>'
  132.           .'<td>s3</td>'
  133.           .'<td>d4</td>'
  134.           .'<td>s5</td>'
  135.           .'<td>Total Asistencias</td>'
  136.           .'<td>U 1</td>'
  137.           .'<td>U 2</td>'
  138.           .'<td>U 3</td>'
  139.           .'<td>U 4</td>'
  140.           .'<td>U 5</td>'
  141.           .'<td>U 5</td>'
  142.           .'<td>Promedio Final</td></tr>';
  143.  
  144. while ($row=mysql_fetch_array($usuario))
  145. {
  146.     print '<tr>'
  147.           .'<td>'.$row['Nombre']."  ".$row['A_Paterno']."  ".$row['A_Materno'] .'</td>'
  148.           .'<td>'.'<input type="checkbox" name="s1" />'.'</td>'
  149.           .'<td>'.'<input type="checkbox" name="d1" />'.'</td>'
  150.           .'<td>'.'<input type="checkbox" name="s2" />'.'</td>'
  151.           .'<td>'.'<input type="checkbox" name="d2" />'.'</td>'
  152.           .'<td>'.'<input type="checkbox" name="s3" />'.'</td>'
  153.           .'<td>'.'<input name="asistencias" type="text" size="10" />'.'</td>'
  154.           .'<td>'.'<input name="calif1" type="text" size="6" />'.'</td>'
  155.           .'<td>'.'<input name="calif2" type="text" size="6" />'.'</td>'
  156.           .'<td>'.'<input name="calif3" type="text" size="6" />'.'</td>'
  157.           .'<td>'.'<input name="calif4" type="text" size="6" />'.'</td>'
  158.           .'<td>'.'<input name="calif5" type="text" size="6" />'.'</td>'
  159.           .'<td>'.'<input name="calif6" type="text" size="6" />'.'</td>'
  160.           .'<td>'.'<input name="promedio" type="text" id="textfield"  size="10" />'.'</td>'
  161.           .'</tr>';  
  162. }
  163. print '</table>';
  164. }
  165. ?>
  166. </form>
  167. </body>
  168. </html>

BUENO COMPAÑEROS, LA BRONCA ES ESTA:
QUIERO QUE EL BOTONO ''MOSTRAR'' HAGA SU FUNCION...MOSTRAR!!
PERO POR ALGUNA RAZON QUE NO HE VISTO O SE, NO LA PUEDO LLEVAR A CABO!

AYUDENME CAMARADAS, SI NECESITAN UN DATO SE LOS PROVEERE PARA SOLUCIONAR ESTE PROBLEMA.

GRACIAS!
  #2 (permalink)  
Antiguo 16/06/2011, 10:08
Avatar de Patriarka  
Fecha de Ingreso: enero-2011
Ubicación: Moreno, Buenos Aires, Argentina
Mensajes: 2.851
Antigüedad: 13 años, 2 meses
Puntos: 288
Respuesta: boton mostrar

te recomiendo que encapsules el codigo ajax
o uses alguna libreria como sajax o Pajax para que simplifiquen la vida

en lo personal no me gusta cuando envian todo codigo
quizas seria mejor nos muestres exactamente que partes son las que te generan el problema

tendrias que hacer alerts para ver el valor que vas recibiendo o bien con el firebug
  #3 (permalink)  
Antiguo 16/06/2011, 10:13
Avatar de truman_truman  
Fecha de Ingreso: febrero-2010
Ubicación: /home/user
Mensajes: 1.341
Antigüedad: 14 años, 2 meses
Puntos: 177
Respuesta: boton mostrar

Pero cuando le das al boton , que es lo que se muestra?
Aparece algun error?
Se ve la tabla?
O no se ve nada?
o se ve parte de la tabla?
__________________
la la la
  #4 (permalink)  
Antiguo 16/06/2011, 10:16
Avatar de HerbyBocho  
Fecha de Ingreso: mayo-2011
Ubicación: Chihuahua, Chihuahua, Mexico
Mensajes: 52
Antigüedad: 12 años, 10 meses
Puntos: 1
Respuesta: boton mostrar

ps mira carnal, la bronca esta con lo de la variable de finicio (fecha inicio), la variable se jala automaticamente a su respectivo menuLista cuando previamente hayas elegido un municipio, ok! hasta ahi no hay problema...entonces tomando en cuenta el estado, municipio y fecha de inicio al darle click al boton, este me desplegaria una tabla mostrando unos datos los cuales tendrian como referencia el estado, municipio y fecha de inicio PERO NO ME MUESTRA NADA, los datos previamente los habia ingresado en una base de datos ''de prueba'' con ayuda de otra pagina la cual sirve como ''ingreso de datos'', la pagina con la que tengo problemas funciona como ''consulta de datos'' para solo mostrar la informacion que tengo al darle click a ESE boton pero ps tengo un bloqueo mental jeje y no logro ver la razon del problema
  #5 (permalink)  
Antiguo 16/06/2011, 10:22
Avatar de truman_truman  
Fecha de Ingreso: febrero-2010
Ubicación: /home/user
Mensajes: 1.341
Antigüedad: 14 años, 2 meses
Puntos: 177
Respuesta: boton mostrar

Pregunto: En el codigo que pusiste , donde se guarda la fecha de inicio, no veo ningun select ni ningun campo hidden en donde se guarde
__________________
la la la
  #6 (permalink)  
Antiguo 16/06/2011, 10:27
Avatar de HerbyBocho  
Fecha de Ingreso: mayo-2011
Ubicación: Chihuahua, Chihuahua, Mexico
Mensajes: 52
Antigüedad: 12 años, 10 meses
Puntos: 1
Respuesta: boton mostrar

eeeeeeeeeeeese es el problema, carnal!
no se en que parte del codigo iria la parte de poder guardar la variable de fecha de inicio!!

ayudame carnalito! POR TODO LO BUENO Y BARATO DE ESTE MUNDO!!!
  #7 (permalink)  
Antiguo 16/06/2011, 10:34
Avatar de truman_truman  
Fecha de Ingreso: febrero-2010
Ubicación: /home/user
Mensajes: 1.341
Antigüedad: 14 años, 2 meses
Puntos: 177
Respuesta: boton mostrar

Crear un campo oculto y guardarla ahí
<input name="finicio" type="hidden" value="LA FECHA DE HOY">
__________________
la la la

Etiquetas: botones
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:28.