Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

96
Vistas
filter table or liste view of data base using php or js

I have a listeview ( table )that shows data of my database , i want to add filter or search box which helps the user to filter the table ( search his name or his infos make other values invisible ) .. I am a beginner in php and js , could you help me or give any solution i can use it ? thankyou

this is my php code(table):

 <?php



$sql="select * from  association  ORDER BY  id ASC"; 
 $result=mysqli_query($con,$sql); 
 if($result){ 

    $num = 1;


    while($ass = mysqli_fetch_array($result)){
       
      $idAss=$ass['idAss'];
      $nom=$ass['nom'];
      $typeActivite=$ass['typeActivite'];
      $location=$ass['location'];
      $adresse=$ass['adresse'];
      $Admin=$ass['Admin'];
$numTel=$ass['numTel'];
$email=$ass['email'];

 echo ' 

                <tr>
                  <th scope="row">'.$num++.'</th>
        
                  <td>'.$idAss.'</td>
                  <td>'.$nom.'</td>
                  <td>'.$typeActivite.'</td>
                  <td>'.$location.'</td>
                  <td>'.$adresse.'</td>
                  <td>'.$Admin.'</td>
                  <td>'.$numTel.'</td>
                  <td>'.$email.'</td>
                
                
                  <td><button class="btn btn-primary">
                  <i class="fa fa-pencil" aria-hidden="true"></i>
                  <a href="update.php?updateid='.$idAss.'" class="text-light">تعديل</a>
                  </button>
                  </td>
                
                  <td> <button class="btn" >
                  <i class="fa fa-trash-o" aria-hidden="true" red-color></i>
                 
                   <a href="deleteAss.php?deleteid='.$idAss.'" class="text-light">حذف</a>
                   </button>
                   </td>
                 

                 
                 
                </tr>
        ';
   }     }
?>

and here is my table: click to see the table

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This is just an example that will search by a given name, you will need to perfect it and ensure you're safe against SQL Injection.

Create the form in an HTML file, for example form.html:

<html>
<body>

<form action="process_data.php" method="post">
Search by name: <input type="text" name="search_input">
<input type="submit">
</form>

</body>
</html> 

Then in the PHP file you're calling (I called it process_data.php) just add and change these lines at the top:

//THIS IS JUST A SHORT EXAMPLE. IN THE PRODUCTION/FINAL VERSION YOU MUST SANITISE DATA!!

if (isset($_POST['search_input'])) $search = "WHERE nom = '$_POST[search_input]';
$search = mysqli_real_escape_string($con, $search);

$sql="select * from  association $search ORDER BY id ASC"; 
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda