Foros del Web » Programando para Internet » Javascript »

user funcion de php

Estas en el tema de user funcion de php en el foro de Javascript en Foros del Web. hola: tengo el siguiente formulario en mi archivo sidebar: @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código html: Ver original < li >               ...
  #1 (permalink)  
Antiguo 01/03/2009, 21:56
Avatar de destor77  
Fecha de Ingreso: noviembre-2004
Ubicación: Gálvez, Santa Fe, Argentina
Mensajes: 2.654
Antigüedad: 19 años, 5 meses
Puntos: 43
user funcion de php

hola:
tengo el siguiente formulario en mi archivo sidebar:
Código html:
Ver original
  1. <li>
  2.                 <h2>Total equipos Ranking</h2>
  3.                     <p>
  4.                     <strong>
  5.                     <?php
  6.                     echo totalEquipos();
  7.                     ?></strong>
  8.                     equipos participando
  9.                     </p>
  10.             </li>
  11.             <?if(!empty($_REQUEST['modules'])){ ?>
  12.             <li>
  13.                     <h2>Buscar Equipo</h2>
  14.                     <p>
  15.                     <form action="<? echo "index.php?modules=".$_REQUEST['modules']."&amp;opcion=busacdor"; ?>" method="post">
  16.                     <?
  17.                         $temp=temporadaActual();
  18.                         $fecha=fechadb($temp);?>
  19.                         <select name="tipo">
  20.                             <option value="1">Por id</option>
  21.                             <option value="2">Por Usuario</option>
  22.                             <option value="3">Por Nombre Equipo</option>
  23.                         </select><br/>
  24.                         <select name="ranking">
  25.                             <option value="1">Ranking Estrellas</option>
  26.                             <option value="2">Ranking Posiciones</option>
  27.                             <option value="3">Ranking HT</option>
  28.                             <option value="4">Ranking Division</option>
  29.                         </select><br/>
  30.                         <input type="text" name="texto" value="" /><br/>
  31.                         <input type="hidden" name="temp" value="<? echo $temp;?>"/>
  32.                         <input type="hidden" name="fecha" value="<? echo $fecha;?>"/>
  33.                         <input type="submit" value="buscar" />
  34.                     </form></p>
  35.             </li>
  36.             <?} ?>
  37.             <li>
  38.                 <h2>Ranking</h2>
  39.                 <ul>
  40.                     <li><a href="index.php?modules=ranking" title="Ranking por Ranking HT">Por ranking HT</a></li>
  41.                     <li><a href="index.php?modules=estrellas" title="Ranking por Estrellas obtenidas">Por estrellas</a></li>
  42.                     <li><a href="index.php?modules=posiciones" title="Ranking por posici&oacute;n en la liga">Por posiciones</a></li>
  43.                     <li><a href="index.php?modules=division" title="Ranking por division donde juega">Por divisi&oacute;n</a></li>
  44.                 </ul>
  45.             </li>

y en mi archivo functions.php tengo esta funcion:
Código php:
Ver original
  1. function buscarEquipo($modulo,$tipo,$ranking,$busqueda,$temp,$fecha){
  2.     //armo el where
  3.     switch ($tipo){
  4.         case 1:
  5.             $criterio="ae.id_hattrick='$busqueda'";
  6.         break;
  7.        
  8.         case 1:
  9.             $criterio="ae.id_dueño='$busqueda'";
  10.         break;
  11.        
  12.         case 1:
  13.             $criterio="ae.id_nombre='$busqueda'";
  14.         break;
  15.     }
  16.     //obtengo la tabla y el campo a devolver
  17.     switch ($ranking){
  18.         case 1:
  19.             $campo="estrellas";
  20.             $tabla="estrellas";
  21.         break;
  22.        
  23.         case 2:
  24.             $campo="posicion";
  25.             $tabla="posiciones";
  26.         break;
  27.        
  28.         case 3:
  29.             $campo="ranking";
  30.             $tabla="ranking";
  31.         break;
  32.        
  33.         case 4:
  34.             $campo="division";
  35.             $tabla="division";
  36.         break;
  37.        
  38.     }
  39.     //cargo todos los id de los equipos
  40.     $sql="SELECT ar.id_hattrick, nombre
  41.                   FROM aseh_".$tabla." AS ar
  42.                   JOIN aseh_equipos AS ae ON ar.id_hattrick = ae.id_hattrick
  43.                   where  id_temp='$temp' and id_fecha='$fecha' order by ASC";
  44.     $result=mysql_query($sql);
  45.     while($row=mysql_fetch_array($result)){
  46.         $items[]=$row['id_hattrick'];
  47.     }
  48.    
  49.     //busco el equipo
  50.     $sql="SELECT $campo, a.id_hattrick, nombre
  51.                   FROM aseh_".$tabla." AS a
  52.                   JOIN aseh_equipos AS ae ON a.id_hattrick = ae.id_hattrick
  53.                   where ".$criterio." and a.id_temp='$temp' and a.id_fecha='$fecha'";
  54.     $result=mysql_query($sql);
  55.    
  56.     $tot=mysql_num_rows($result);
  57.     if($tot!=0){
  58.         $equipo=mysql_fetch_array($result);
  59.         $pos=array_search($equipo['id_hattrick'],$items);
  60.         $pagina = ceil($pos / 30);
  61.         redirect('index.php?modules='.$modulo.'&amp;verPagina='.$pagina.'');
  62.     }
  63. }

mi duda es como hacer que se ejecute la funcion buscar equipo cada vez que se hace click en el boton buscar, ya que el sidebar siempre se carga independientemente del modulo que muestro en la pagina, la idea es no recargar toda la pagina.
Espero que se haya entendido el problema y desde ya muchas gracias
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 03:30.