Ver Mensaje Individual
  #23 (permalink)  
Antiguo 10/07/2012, 20:45
Avatar de rodrigo791
rodrigo791
 
Fecha de Ingreso: noviembre-2009
Ubicación: Uruguay
Mensajes: 1.339
Antigüedad: 14 años, 5 meses
Puntos: 168
Respuesta: Variables no pasan en etiqueta form

Tenes un entrevero de código impresionante que no sabes ni lo que estas haciendo.
Trata de usar Highlight para mostrar tu codigo es bastante molesto tener que leerlo sin él, solo tenes que elegir el lenguaje en el select que dice "Highlight"
1 - decidite de una vez, LLAMAS A LA FUNCIÓN EN ONLOAD O CON EL BOTON?
supongamos que lo haces con el boton.No se para que le pasas como parametro el archivo php a la función si ya ella lo tiene dentro, en fin...


Código HTML:
Ver original
  1. <script type="text/javascript">
  2.  
  3. function objetoAjax(){
  4. var xmlhttp=false;
  5. try {
  6. xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  7. } catch (e) {
  8. try {
  9. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  10. } catch (E) {
  11. xmlhttp = false;
  12. }
  13. }
  14.  
  15. if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  16. xmlhttp = new XMLHttpRequest();
  17. }
  18. return xmlhttp;
  19. }
  20.  
  21.  
  22.  
  23. function MostrarConsulta(){
  24.  
  25. var divResultado = document.getElementById('resultadoDeLaRespuesta');
  26.  
  27. var t1 = document.getElementById("categoria").value;
  28.  
  29. var t2 = document.getElementById("orden").value;
  30.  
  31. ajax=objetoAjax();
  32. ajax.open("GET", "filtroconsulta.php?t1="+t1+"&t2="+t2,true);
  33. ajax.onreadystatechange=function() {
  34. if (ajax.readyState==4) {
  35. var abc = ajax.responseText;
  36. divResultado1.innerHTML = abc;
  37.  
  38. }
  39. }
  40. ajax.send(null)
  41. }
  42.  
  43. </head>
  44. <form method="get" name="frm" action="" onsubmit="MostrarConsulta();">
  45. <div class="filtro1">Categoria: <select name="categoria" id="categoria">
  46. <option value="opcion1">opcion1
  47. <option value="opcion2">opcion2
  48. <option value="opcion3" selected>opcion3
  49. </div>
  50.  
  51. <div class="filtro2">Informacion: <select name="orden" id="orden">
  52. <option value="opcion1">opcion1
  53. <option value="opcion2">opcion2
  54. <option value="opcion3" selected>opcion3
  55. </div>
  56. <input type="submit" value="Aplicar Filtro">
  57. </form>
  58.  
  59. <div id="resultadoDeLaRespuesta"></div>
  60. </body>

tu php:
Código PHP:
Ver original
  1. <?
  2. $categoria = $_GET['t1'];
  3. $orden = $_GET['t2'];
  4.  
  5. echo $categoria;
  6. echo "<br />";
  7. echo $orden;
  8. ?>

A ver como te va con eso

Última edición por rodrigo791; 10/07/2012 a las 21:02