Problema con una consulta en mysql desde php

Hola como estas, estoy tratando de hacer una consulta a mi base de datos mediante el valor que selecciono en un combobox y no he podido, por favor si eres tan amable y me colaboras.
A continuación te adjunto mi código
consultaemp.php   /// por medio de este archivo hago la consulta
<?php
include ("seguridad.php");
?> 
<html>
<head>
<title>MINA NUEVA MED & CIA LTDA </title>
<td><img src="cabezote.jpg" width="1019" height="180" /></td>
</head>
<body>
<form action="min.php" method="post" name="mina">
<?php 
  $result=mysql_query("select * from empleados where (Codigo_mina = "$_POST['mina']") ",$link); 
?>
<div align="center"> 
<table width="724" height="31" border=1 cellpadding=1 cellspacing=1 bordercolor="#000000">
<tr>
<td width="96">
<div align="center"><strong>COD MINA</strong></div>
</td>
<td width="81">
<div align="center"><strong>CEDULA</strong></div>
</td>
<td width="272">
<div align="center"><strong>NOMBRE</strong></div>
</td>
<td width="158">
<div align="center"><strong>CARGO</strong></div>
</td>
<td width="89">
<div align="center"><strong>SALARIO</strong></div>
</td>
</tr>
<?php       
   while($row = mysql_fetch_array($result)) { 
      printf("
<tr>
<td> %s</td>
<td> %s </td>
<td> %s</td>
<td> %s</td>
<td> %s </td>
</tr>
", $row["Codigo_mina"], $row["Cedula"], $row["Nombre"], $row["Cargo"], $row["Salario"]); 
   } 
   mysql_free_result($result); 
   mysql_close($link); 
?>
</table>
</div>
</form>
<br> 
<br>
</body>
</html>
min.php      /// con este archivo cargo los datos al combobox
<html>
<head>
</head>
<body>
<?php
include("conex.phtml"); 
$link=Conectarse();
?>
<?php 
echo"<select name=mina id=nombre_dado>"; 
$sql="SELECT Codigo_mina FROM minas"; 
$result=mysql_query($sql); 
$i=0; 
while ($row=mysql_fetch_row($result)) 

echo "<option value=".$row[$i].">".$row[$i]."</option>\n"; 

echo "</select>"; 
?>
</body>
</html>

1 Respuesta

Respuesta
1
No me dices si tienes algún error o fallo, ni me detallas NADA... pero te puedo decir que:
echo"<select name=mina id=nombre_dado>";
O le cambias el id a mina o cambias el nombre de lo que recojes ($_POST['nombre_dado'].
Si te ha servido, no olvides evaluar y cerrar la pregunta. Sino, seguimos mirando...

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas