Ver Mensaje Individual
  #3 (permalink)  
Antiguo 08/04/2011, 15:12
plataformas
 
Fecha de Ingreso: julio-2003
Ubicación: Santiago
Mensajes: 26
Antigüedad: 20 años, 9 meses
Puntos: 0
Exclamación Respuesta: Mostrar imagen en celda tras obtener ruta desde base mysql mediante select

Gracias amigo pero me esta dando 2 errores

Detalles de error de página web 1

Agente de usuario: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
Fecha: Fri, 8 Apr 2011 20:59:31 UTC


Mensaje: 'codigo' is undefined
Línea: 65
Carácter: 2
Código: 0
URI: http://www.bto.cl/editalink.php?&SID=14f42afa7537582a7d3544543222569 d

DETALLE ERROR 2
<img id="mostrar" name="fotolink" id="fotolink" src='fotol/default.jpg' alt="IMAGEN LINK" height='80' width='180' align='center' />

me lo muestra como error

y el codigo ya con el tuyo embebido
es :

<?PHP
// CONECTAMOS A LA BASE DE DATOS
include("conexion.php");
$link=Conectarse();
?>



adjunto el godigo que me enviaste con las modificaciones la variable $link la tengo definida al principio por lo solo la invoco dentro de tu codigo.



esto esta en el HEAD
<script language="JavaScript" type="text/JavaScript">
// FUNCION VALIDA FECHA EN BLANCO
function ValNombre(pCampo)
{
// Verifica si no esta en blanco
if (pCampo == "")
{ alert("EL NOMBRE DEL LINK NO PUEDE ESTAR EN BLANCO");
document.Formulario.nombre.focus();
return false;
}
// Devuelve validación sin errores
return true;
}
// VALIDA TITULO EN BLANCO
function ValVinculo(pCampo)
{
// Verifica si no esta en blanco
if (pCampo == "" || pCampo.length == 0)
{ alert("EL VINCULO DEL LIN NO PUEDE ESTAR EN BLANCO");
document.Formulario.vinculo.focus();
return false;
}
// Devuelve validación sin errores
return true;
}
<!--FIN FUNCIONES -->
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

TU FUNCION
// FUNCION MUESTRA IMAGEN
function r(sel) {
if(sel.selectedIndex == 0) {
document.getElementById("mostrar").src = "fotosl/default.jpg";
}
codigo.value=sel.options[sel.selectedIndex].getAttribute('codigo');
nombre.value=sel.options[sel.selectedIndex].getAttribute('nombre');
vinculo.value=sel.options[sel.selectedIndex].getAttribute('vinculo');
ruta.value=sel.options[sel.selectedIndex].getAttribute('ruta');
document.getElementById("mostrar").src = sel.options[sel.selectedIndex].getAttribute('ruta');
}
</script>


y luego el html

<table width="100%" border="0" align="center"> <tr> <form name="Formulario" method="post" action="actualizalink.php" enctype="multipart/form-data">
<tr>
<td style="font-family:Tahoma, Geneva, sans-serif; font-size:12px; color:#930; font-weight: bold;" width="140" height="20" align="left"><span class="Estilo6"><strong>Seleccionar Link</strong></span></td>
<td width="371">
<?php
mysql_query("SET NAMES 'utf8'"); //selecciona el cotejamiento de la base de datos mysql_select_db("universidad",$link);
$cadena = mysql_query("SELECT * FROM links ORDER BY id ASC",$link); ?>

<select name="selecnot" id="selecnot" onChange="r(this)"> <option value="0" responsable="">Seleccione Link </option> <?php while ($row = mysql_fetch_assoc($cadena)) { ?> <option value="<?php echo $row['id']?>"codigo="<?php echo $row['id']?>"nombre="<?php echo $row['nombre']?>"vinculo="<?php echo $row['vinculo']?>"ruta="<?php echo $row['ruta']?>" > <?php echo $row['nombre']?> </option>

<?PHP
// GUARDO LA RUTA DE LA IMAGEN SELECCIONADA
$fotoactual = $row['ruta']; } ?>
</select>

<label> <input name="codigo" type="hidden" id="codigo" /> </label>
</td>
</tr>
<!-- AQUI QUIERO QUE SE MUESTRE LA IMAGEN QUE CORRESPONDE A LA OPCION ELEGIDA DEL SELECT --> <tr> <td style="font-family:Tahoma, Geneva, sans-serif; font-size:12px; color:#930; font-weight: bold;" width="140" align="left">Imagen Actual</td>

<td align="left">
<?php echo $fotoactual; ?>
<img id="mostrar" name="fotolink" id="fotolink" src='fotol/default.jpg' alt="IMAGEN LINK" height='80' width='180' align='center' />
</td>
</tr>
<!-- fin de la muestra de imagen -->

Espero me puedas corregir los errores y te pasaste muchas gracias por la ayuda