Foros del Web » Creando para Internet » HTML »

Añadir boton al buscador

Estas en el tema de Añadir boton al buscador en el foro de HTML en Foros del Web. Tengo este buscador pero al pasar el cursor con el mouse no sirve, solo funciona dando Enter Código PHP: function  index () {          c ( ...
  #1 (permalink)  
Antiguo 01/05/2013, 09:03
Avatar de ChatDelMundo  
Fecha de Ingreso: abril-2013
Mensajes: 98
Antigüedad: 11 años
Puntos: 1
Añadir boton al buscador



Tengo este buscador pero al pasar el cursor con el mouse no sirve, solo funciona dando Enter
Código PHP:
function index() {
        
c('
        <form action="'
.url('search/listing').'" method="post">
        <p>
        <label>title</label> <input type="text" name="title" />
        </p>
        <p>
        <input type="submit" class="button" value="'
.t('Submit').'" />
        </p>
        </form>
        '
);
    }
    
    function 
listing() {
        global 
$offset$num_per_page$page;
        
$title trim($_POST['title']);
        
$display_title stripslashes(trim($_POST['title']));
        
c('Searching <strong>'.h($title).'</strong><br />');
        if (
strlen($title) < 3) {
            
sys_back(t('Keyword is too short'));
        }
        else {
            
$hash substr(md5($title),0,12);
            if (
$c get_cache($hash)) {
                
header("location:".url('search/result/'.$hash));
                exit;
            }
            else {
                
$c '<h1>'.h($display_title).'</h1>';
                
$res sql_query("select * from ".tb()."accounts where username like '%{$title}%' or fullname like '%{$title}%'  order by lastlogin DESC limit 10");
                while (
$user sql_fetch_array($res)) {
                    
$users .= '<li>'.url('u/'.$user['username'],$user['username']).'<br />'.avatar($user).'<br />'.h($user['fullname']).'</li>';
                }
                if (
strlen($users)) {
                    
$c .= '<h2>'.t('Members').'</h2>';
                    
$c .= '<ul class="small_avatars">'.$users.'</ul>';
                }
                
$c .= '<h2>'.t('Stories').'</h2>
                    <p>Searching for <strong>"'
.h($title).'"</strong></p>';
                
$res sql_query("select s.*,u.username from `".tb()."stories` as s left join ".tb()."accounts as u on u.id=s.uid where s.title LIKE '%$title%' ORDER BY s.id DESC LIMIT 20");
                if (!
sql_counts($res)) {
                    
$c .= '<p>no story matched</p>';
                }
                else {
                    
$c .= 'Stories:<br /><ul class="post">';
                    while(
$story sql_fetch_array($res)) {
                        
$c .= '<li>
                        ['
.url($story['app'],app_name($story['app'])).'] 
                        <a href="'
.url($story['app'].'/viewstory/'.$story['id']).'">'.str_replace($title,'<strong>'.h($title).'</strong>',htmlspecialchars($story['title'])).'</a><br />'.get_date($story['created']).', by '.url('u/'.$story['username'],$story['username']).'
                        </li>'
;
                    }
                    
$c .= '</ul>';
                }
                
set_cache($hash$c48);
                
header("location:".url('search/result/'.$hash));
                exit;
            }
        }
    }

    function 
result($hash) {
        
set_title('Search result');
        
c(get_cache($hash).get_gvar('ad_block_search'));
    }
    

__________________
chatdelmundo.es
  #2 (permalink)  
Antiguo 01/05/2013, 09:40
Avatar de repara2  
Fecha de Ingreso: septiembre-2010
Ubicación: München
Mensajes: 2.445
Antigüedad: 13 años, 7 meses
Puntos: 331
Respuesta: Añadir boton al buscador

Tengo este buscador pero al pasar el cursor con el mouse no sirve, solo funciona dando Enter no funciona el botón?
__________________
Fere libenter homines, id quod volunt, credunt.
  #3 (permalink)  
Antiguo 01/05/2013, 10:55
Avatar de ChatDelMundo  
Fecha de Ingreso: abril-2013
Mensajes: 98
Antigüedad: 11 años
Puntos: 1
Respuesta: Añadir boton al buscador

Cita:
Iniciado por repara2 Ver Mensaje
no funciona el botón?
Le quiero colocar este tipo de boton al lado del espacio donde se escribe el texto:

__________________
chatdelmundo.es
  #4 (permalink)  
Antiguo 01/05/2013, 11:54
Avatar de pitufoweb  
Fecha de Ingreso: enero-2008
Ubicación: Un Mundo Raro
Mensajes: 1.148
Antigüedad: 16 años, 3 meses
Puntos: 181
Respuesta: Añadir boton al buscador

Hola,

Creo que no entiendo tu problema.

para poner el botón solo tendrías que poner:
<input type="submit" value="Buscar" />




Saludos
__________________
------------- " La felicidad no llega de afuera, nace desde dentro. " -------------
  #5 (permalink)  
Antiguo 01/05/2013, 14:12
Avatar de ChatDelMundo  
Fecha de Ingreso: abril-2013
Mensajes: 98
Antigüedad: 11 años
Puntos: 1
Respuesta: Añadir boton al buscador

Cita:
Iniciado por pitufoweb Ver Mensaje
para poner el botón solo tendrías que poner:
<input type="submit" value="Buscar" />
Saludos
¿En que parte lo dejo?
__________________
chatdelmundo.es

Etiquetas: boton, buscador, php, select, sql
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 18:57.