Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/07/2008, 14:52
fran321
 
Fecha de Ingreso: octubre-2007
Mensajes: 57
Antigüedad: 16 años, 6 meses
Puntos: 0
Hipervínculo de imagen dentro de una tabla y de un formulario

¿Por qué funciona este código?:

Código PHP:
    <table border=1 cellspacing=0 cellpadding=1>
      <TR><TD><STRONG>&nbsp;Fecha&nbsp;</STRONG></TD><TD><STRONG>&nbsp;Profesor&nbsp;</STRONG></TD><TD><STRONG>&nbsp;Departamento&nbsp;</STRONG></TD><TD><STRONG>&nbsp;Copias&nbsp;</STRONG></TD><TD><STRONG>&nbsp;Eliminar registre&nbsp;</STRONG></TD></TR>
<?php      

   
while($row2 mysql_fetch_array($result2)) {
      
printf("<tr><td>&nbsp;%s&nbsp;</td><td>&nbsp;%s&nbsp;</td><td>&nbsp;%s&nbsp;</td>
      <td>&nbsp;%s&nbsp;</td><td><a href=\"eliminar_registro.php?idcopias=%d\">Borrar</a></td></tr>"
$row2["Fecha"],$row2["Nombre"]." ".$row2["Apellidos"], 
      
$row2["Departamento"],$row2["Copias"], $row2["id"]);
   }
   
mysql_free_result($result2);
   
mysql_close($link);
?>
    </table>
y al sustituir el texto "Borrar" del hipervínculo (<a href=\"eliminar_registro.php?idcopias=%d\">Borrar</a>) por una imagen no funciona:


Código PHP:
    <table border=1 cellspacing=0 cellpadding=1>
      <TR><TD><STRONG>&nbsp;Fecha&nbsp;</STRONG></TD><TD><STRONG>&nbsp;Profesor&nbsp;</STRONG></TD><TD><STRONG>&nbsp;Departamento&nbsp;</STRONG></TD><TD><STRONG>&nbsp;Copias&nbsp;</STRONG></TD><TD><STRONG>&nbsp;Eliminar registre&nbsp;</STRONG></TD></TR>
<?php      

   
while($row2 mysql_fetch_array($result2)) {
      
printf("<tr><td>&nbsp;%s&nbsp;</td><td>&nbsp;%s&nbsp;</td><td>&nbsp;%s&nbsp;</td>
      <td>&nbsp;%s&nbsp;</td><td><a href=\"eliminar_registro.php?idcopias=%d\"><img border=0 src="
images/borrar.png"></a></td></tr>"$row2["Fecha"],$row2["Nombre"]." ".$row2["Apellidos"], 
      
$row2["Departamento"],$row2["Copias"], $row2["id"]);
   }
   
mysql_free_result($result2);
   
mysql_close($link);
?>
    </table>

Error: Parse error: parse error, unexpected T_STRING in D:\www\index.php on line 96, que ocurre cuando hago el cambio (<a href=\"eliminar_registro.php?idcopias=%d\"><img border=0 src="borrar.png"></a>)

Alguien puede ayudarme?

He probado este enlace a parte y sí funciona, pues la sintaxis está bien:

Código PHP:
<a href="js_calendar.html"><img border=0 src="images/borrar.png"></a

Última edición por fran321; 17/07/2008 a las 15:21