Ver Mensaje Individual
  #2 (permalink)  
Antiguo 26/06/2011, 21:20
Avatar de blakmetall
blakmetall
 
Fecha de Ingreso: diciembre-2010
Ubicación: Jalisco
Mensajes: 181
Antigüedad: 13 años, 5 meses
Puntos: 18
Respuesta: Problema con link

Aqui te dejo tu codigo con una pequeña modificacion.

Código PHP:
Ver original
  1. <head>
  2. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  3. <title>Documento sin título</title>
  4. <script>
  5.  
  6. function cargo_detalle(id){
  7.     document.getElementById('hidden_prod').value=id;
  8.     form_prod.action="idetalle_producto.php"
  9.     form_prod.submit();
  10. }
  11. </script>
  12.  
  13. </head>
  14. <body>
  15. <?php
  16. $conn = Conectarse();
  17. $sql = "SELECT p.id_producto,p.nombre, p.descripcion, e.nombre_empresa, p.id_empresa
  18.        FROM productos p, empresas e
  19.        WHERE p.id_empresa = e.id_empresa and p.id_empresa = '$id_empresa'";
  20. $res = ejecutar_consulta($sql,$conn);
  21.  
  22. if(!empty($id_empresa)){
  23. echo "<form name='form_prod' id='form_prod' method='post'>";
  24. echo "<table width='400'>";
  25. echo "<tr>";
  26.     if(mysql_num_rows($res) != 0){
  27.         while($row = mysql_fetch_array($res)){
  28.             $id_prod = $row['id_producto'];
  29.             echo "<th align='left'>Producto:</th>";
  30.             echo "<td>" .$row['nombre']. "</td>";
  31.             echo "</tr>";
  32.             echo  "<th align='left'>Descripcion:</th>";     //comillas en la llamada a cargo_detalle
  33.             echo "<td><a href='#' onclick='cargo_detalle(\"{$id_prod}\")'>" .$row['descripcion']. "</a></td>";
  34.             echo "</tr>";   //falto cerrar punto y coma
  35.             echo "<td bgcolor='#FFFF00' align='center'>Empresa</td>";
  36.             echo "<td>" .$row['empresa']. "</td>";  //aqui faltaba cerrar comillas y punto y coma.
  37.             echo "</tr>";
  38.         }
  39.         echo "<input type='hidden' id='hidden_prod' name='hidden_prod'>";
  40.         echo "</form>";
  41.     }else{
  42.         echo "<td align='center'>La empresa no tiene Productos</td>";
  43.         echo "</tr>";
  44.         echo "</table>";
  45.     }
  46. }
  47. ?>
  48.  
  49. </body>

Por cierto como pones para que el frame donde tienes el codigo se vea diferente, yo siempre pongo highlight PHP.