Skip to main content
Remover Stack Snippet
Origen Enlace
Rubén
  • 11.5k
  • 7
  • 41
  • 85

<head>
<!--<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
--><script src="jquery-3.2.1.min.js"> </script>

<style>
tr:hover {background-color:#CBCBCB;}
div.scroll{
    width: 100%;
    height: 50%;
    overflow-y: scroll;
    overflow-x: hidden;
    
    }
    

</style>


<script language="javascript">
$(document).ready(function(){
    $('.llamar').submit(function(){
        
    var x = confirm("Are you sure you want to update?");
      if (x){
        $.ajax({
          type: "POST",
          url: "buscar2.php",
          data: $(this).serialize(),
          cache: false,
          success: function(data) {
                //$('#result').show(3000);
                
                $('#result').html(data).
            fadeIn().delay(1000).fadeOut();

            }
        });//end ajax
        return false;
      }
      
    });
});
</script>

</head>
<div class="scroll">

<?php
  
      $buscar = $_POST['b'];
        
      if(!empty($buscar)) {
            buscar($buscar);
      }
        
      function buscar($b) {
            $con = mysql_connect('localhost','root', 'master3.1416');
            mysql_select_db('tel', $con);
        
            $sql = mysql_query("SELECT * FROM tel WHERE nombre LIKE '%".$b."%' OR tel LIKE '%".$b."%' LIMIT 30" ,$con);
              
            $contar = @mysql_num_rows($sql);
              
            if($contar == 0){
                  echo "No se han encontrado resultados para '<b>".$b."</b>'.";
            }else{
              while($row=mysql_fetch_array($sql)){
                $id = $row['id'];
                $nombre = $row['nombre'];
                $tel = $row['tel'];
            
             echo "<center>";
             
              echo"<form  autocomplete='off' class='llamar' onsubmit='return false'  > \n";
                
             echo"<table cellpadding='10' cellspacing='0' > \n";
            
             
             
                echo"<tr> \n";
                
                echo"<td  width='0' > <input type='text' size='0' name='id[]' value='$id' hidden /> </td> \n";
                
                echo"<td  width='200' > <input type='text' size='50' name='nombre[]' value='$nombre' required /> </td> \n";
                
                echo"<td width='20' > <input type='text' size='20' name='tel[]' value='$tel' required /> </td> \n";
                echo"</tr> \n";
                echo"</table> \n";
                
              }
                                        echo"<input name='submit' type='submit' value='Editar' />";

                echo"</form>";
                
                echo"</center>";
                
                

            
        }
  }
        
?>
</div>
<div id="result"> </div>

<head>
<!--<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
--><script src="jquery-3.2.1.min.js"> </script>

<style>
tr:hover {background-color:#CBCBCB;}
div.scroll{
    width: 100%;
    height: 50%;
    overflow-y: scroll;
    overflow-x: hidden;
    
    }
    

</style>


<script language="javascript">
$(document).ready(function(){
    $('.llamar').submit(function(){
        
    var x = confirm("Are you sure you want to update?");
      if (x){
        $.ajax({
          type: "POST",
          url: "buscar2.php",
          data: $(this).serialize(),
          cache: false,
          success: function(data) {
                //$('#result').show(3000);
                
                $('#result').html(data).
            fadeIn().delay(1000).fadeOut();

            }
        });//end ajax
        return false;
      }
      
    });
});
</script>

</head>
<div class="scroll">

<?php
  
      $buscar = $_POST['b'];
        
      if(!empty($buscar)) {
            buscar($buscar);
      }
        
      function buscar($b) {
            $con = mysql_connect('localhost','root', 'master3.1416');
            mysql_select_db('tel', $con);
        
            $sql = mysql_query("SELECT * FROM tel WHERE nombre LIKE '%".$b."%' OR tel LIKE '%".$b."%' LIMIT 30" ,$con);
              
            $contar = @mysql_num_rows($sql);
              
            if($contar == 0){
                  echo "No se han encontrado resultados para '<b>".$b."</b>'.";
            }else{
              while($row=mysql_fetch_array($sql)){
                $id = $row['id'];
                $nombre = $row['nombre'];
                $tel = $row['tel'];
            
             echo "<center>";
             
              echo"<form  autocomplete='off' class='llamar' onsubmit='return false'  > \n";
                
             echo"<table cellpadding='10' cellspacing='0' > \n";
            
             
             
                echo"<tr> \n";
                
                echo"<td  width='0' > <input type='text' size='0' name='id[]' value='$id' hidden /> </td> \n";
                
                echo"<td  width='200' > <input type='text' size='50' name='nombre[]' value='$nombre' required /> </td> \n";
                
                echo"<td width='20' > <input type='text' size='20' name='tel[]' value='$tel' required /> </td> \n";
                echo"</tr> \n";
                echo"</table> \n";
                
              }
                                        echo"<input name='submit' type='submit' value='Editar' />";

                echo"</form>";
                
                echo"</center>";
                
                

            
        }
  }
        
?>
</div>
<div id="result"> </div>

<head>
<!--<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
--><script src="jquery-3.2.1.min.js"> </script>

<style>
tr:hover {background-color:#CBCBCB;}
div.scroll{
    width: 100%;
    height: 50%;
    overflow-y: scroll;
    overflow-x: hidden;
    
    }
    

</style>


<script language="javascript">
$(document).ready(function(){
    $('.llamar').submit(function(){
        
    var x = confirm("Are you sure you want to update?");
      if (x){
        $.ajax({
          type: "POST",
          url: "buscar2.php",
          data: $(this).serialize(),
          cache: false,
          success: function(data) {
                //$('#result').show(3000);
                
                $('#result').html(data).
            fadeIn().delay(1000).fadeOut();

            }
        });//end ajax
        return false;
      }
      
    });
});
</script>

</head>
<div class="scroll">

<?php
  
      $buscar = $_POST['b'];
        
      if(!empty($buscar)) {
            buscar($buscar);
      }
        
      function buscar($b) {
            $con = mysql_connect('localhost','root', 'master3.1416');
            mysql_select_db('tel', $con);
        
            $sql = mysql_query("SELECT * FROM tel WHERE nombre LIKE '%".$b."%' OR tel LIKE '%".$b."%' LIMIT 30" ,$con);
              
            $contar = @mysql_num_rows($sql);
              
            if($contar == 0){
                  echo "No se han encontrado resultados para '<b>".$b."</b>'.";
            }else{
              while($row=mysql_fetch_array($sql)){
                $id = $row['id'];
                $nombre = $row['nombre'];
                $tel = $row['tel'];
            
             echo "<center>";
             
              echo"<form  autocomplete='off' class='llamar' onsubmit='return false'  > \n";
                
             echo"<table cellpadding='10' cellspacing='0' > \n";
            
             
             
                echo"<tr> \n";
                
                echo"<td  width='0' > <input type='text' size='0' name='id[]' value='$id' hidden /> </td> \n";
                
                echo"<td  width='200' > <input type='text' size='50' name='nombre[]' value='$nombre' required /> </td> \n";
                
                echo"<td width='20' > <input type='text' size='20' name='tel[]' value='$tel' required /> </td> \n";
                echo"</tr> \n";
                echo"</table> \n";
                
              }
                                        echo"<input name='submit' type='submit' value='Editar' />";

                echo"</form>";
                
                echo"</center>";
                
                

            
        }
  }
        
?>
</div>
<div id="result"> </div>

<head>
<!--<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
--><script src="jquery-3.2.1.min.js"> </script>

<style>
tr:hover {background-color:#CBCBCB;}
div.scroll{
    width: 100%;
    height: 50%;
    overflow-y: scroll;
    overflow-x: hidden;
    
    }
    

</style>


<script language="javascript">
$(document).ready(function(){
    $('.llamar').submit(function(){
        
    var x = confirm("Are you sure you want to update?");
      if (x){
        $.ajax({
          type: "POST",
          url: "buscar2.php",
          data: $(this).serialize(),
          cache: false,
          success: function(data) {
                //$('#result').show(3000);
                
                $('#result').html(data).
            fadeIn().delay(1000).fadeOut();

            }
        });//end ajax
        return false;
      }
      
    });
});
</script>

</head>
<div class="scroll">

<?php
  
      $buscar = $_POST['b'];
        
      if(!empty($buscar)) {
            buscar($buscar);
      }
        
      function buscar($b) {
            $con = mysql_connect('localhost','root', 'master3.1416');
            mysql_select_db('tel', $con);
        
            $sql = mysql_query("SELECT * FROM tel WHERE nombre LIKE '%".$b."%' OR tel LIKE '%".$b."%' LIMIT 30" ,$con);
              
            $contar = @mysql_num_rows($sql);
              
            if($contar == 0){
                  echo "No se han encontrado resultados para '<b>".$b."</b>'.";
            }else{
              while($row=mysql_fetch_array($sql)){
                $id = $row['id'];
                $nombre = $row['nombre'];
                $tel = $row['tel'];
            
             echo "<center>";
             
              echo"<form  autocomplete='off' class='llamar' onsubmit='return false'  > \n";
                
             echo"<table cellpadding='10' cellspacing='0' > \n";
            
             
             
                echo"<tr> \n";
                
                echo"<td  width='0' > <input type='text' size='0' name='id[]' value='$id' hidden /> </td> \n";
                
                echo"<td  width='200' > <input type='text' size='50' name='nombre[]' value='$nombre' required /> </td> \n";
                
                echo"<td width='20' > <input type='text' size='20' name='tel[]' value='$tel' required /> </td> \n";
                echo"</tr> \n";
                echo"</table> \n";
                
              }
                                        echo"<input name='submit' type='submit' value='Editar' />";

                echo"</form>";
                
                echo"</center>";
                
                

            
        }
  }
        
?>
</div>
<div id="result"> </div>
Origen Enlace

¿Donde puedo colocar el TH en esta tabla?

Hola tengo esta tabla donde muestro un resultado, pero cuando le coloco el TH, el TH se repite la cantidad de veces según el resultado.

<head>
<!--<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
--><script src="jquery-3.2.1.min.js"> </script>

<style>
tr:hover {background-color:#CBCBCB;}
div.scroll{
    width: 100%;
    height: 50%;
    overflow-y: scroll;
    overflow-x: hidden;
    
    }
    

</style>


<script language="javascript">
$(document).ready(function(){
    $('.llamar').submit(function(){
        
    var x = confirm("Are you sure you want to update?");
      if (x){
        $.ajax({
          type: "POST",
          url: "buscar2.php",
          data: $(this).serialize(),
          cache: false,
          success: function(data) {
                //$('#result').show(3000);
                
                $('#result').html(data).
            fadeIn().delay(1000).fadeOut();

            }
        });//end ajax
        return false;
      }
      
    });
});
</script>

</head>
<div class="scroll">

<?php
  
      $buscar = $_POST['b'];
        
      if(!empty($buscar)) {
            buscar($buscar);
      }
        
      function buscar($b) {
            $con = mysql_connect('localhost','root', 'master3.1416');
            mysql_select_db('tel', $con);
        
            $sql = mysql_query("SELECT * FROM tel WHERE nombre LIKE '%".$b."%' OR tel LIKE '%".$b."%' LIMIT 30" ,$con);
              
            $contar = @mysql_num_rows($sql);
              
            if($contar == 0){
                  echo "No se han encontrado resultados para '<b>".$b."</b>'.";
            }else{
              while($row=mysql_fetch_array($sql)){
                $id = $row['id'];
                $nombre = $row['nombre'];
                $tel = $row['tel'];
            
             echo "<center>";
             
              echo"<form  autocomplete='off' class='llamar' onsubmit='return false'  > \n";
                
             echo"<table cellpadding='10' cellspacing='0' > \n";
            
             
             
                echo"<tr> \n";
                
                echo"<td  width='0' > <input type='text' size='0' name='id[]' value='$id' hidden /> </td> \n";
                
                echo"<td  width='200' > <input type='text' size='50' name='nombre[]' value='$nombre' required /> </td> \n";
                
                echo"<td width='20' > <input type='text' size='20' name='tel[]' value='$tel' required /> </td> \n";
                echo"</tr> \n";
                echo"</table> \n";
                
              }
                                        echo"<input name='submit' type='submit' value='Editar' />";

                echo"</form>";
                
                echo"</center>";
                
                

            
        }
  }
        
?>
</div>
<div id="result"> </div>