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

Cita:
Iniciado por plataformas Ver Mensaje
ok revisare nuevo que me puede estar fallando gracias amigo te cuento
Disculpa amigo pero me aparece esto
Detalles de error de página web

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: Tue, 12 Apr 2011 16:30:33 UTC


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

hace referencia a que la variable codigo no se encuentra definida y no me muestra nada

te vuelvo adjuntar el codigo compreto

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


<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;
}
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);
// 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>

<div id="central">
<!-- Center column -->
<table WIDTH="98%" cellpadding="0" cellspacing="0">
<TR>
<TD COLSPAN="5" class="mainpage_subheadline" VALIGN="top" WIDTH="550" HEIGHT="15"><img SRC="images/1x1.gif" WIDTH="550" HEIGHT="15"></TD>
</TR>
<tr>
<td>
<div id="flashcontent">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="65%">
<div id="centro">
<p class="right_boxheadline" align="LEFT" style="width:550px; color: #333;" valign=bottom>MENU DE ADMINISTRACION WEB BTO - EDITAR LINK</p>
</div><img src="images/links.jpg" alt="" width="91" height="66" align="right"/>

<table border="0" align="center">
<tr>
<form name="Formulario" method="post" action="actualizalink.php" enctype="multipart/form-data">
<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
}
?>
</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">
<img id="mostrar" name="fotolink" src="fotol/default.jpg" alt="IMAGEN LINK" height='80' width='180' align='center' />
</td>
</tr>
<!-- fin de la muestra de imagen -->
<tr>
<td style="font-family:Tahoma, Geneva, sans-serif; font-size:12px; color:#930; font-weight: bold;" width="140" align="left">Nombre Link</td>
<td align="left"><input name="nombre" id="nombre" type="text" size="50" maxlength="50" style="font-family:Verdana, Geneva, sans-serif; font-size:11px; color:#F60;" onChange="ValNombre(this.value);"/></td>
</tr>
<tr>
<td style="font-family:Tahoma, Geneva, sans-serif; font-size:12px; color:#930; font-weight: bold;" align="left">Vinculo</td>
<td align="left"><input name="vinculo" id="vinculo" type="text" size="50" maxlength="50" style="font-family:Verdana, Geneva, sans-serif; font-size:11px; color:#F60;" onChange="ValVinculo(this.value);"/></td>
</tr>
<tr>
<td style="font-family:Tahoma, Geneva, sans-serif; font-size:12px; color:#930; font-weight: bold;" align="left">Ruta Imagen</td>
<td align="left">
<input name="ruta" type="text" id="ruta" value="" size="50" maxlength="50" style="font-family:Verdana, Geneva, sans-serif; font-size:11px; color:#F60;" />
</td>
</tr>
<tr>
<td style="font-family:Tahoma, Geneva, sans-serif; font-size:12px; color:#930; font-weight: bold;" width="292" align="left">Seleccionar nueva Imagen</td>
<td align="left"><input type="file" name="imagen" size="36"></td>
</tr>
<tr>
<td height="40" align="center"><input type="submit" name="act" value="Actualizar Link"/></td>
</tr>
</form>
</tr>
</table>
</td>
</tr>
</table>
<table width="31%" border="0" align="center">
<tr>
<td width="175">
<p align="center"><a href="mlinks.php" ><img src="menu/volverm1.jpg" alt="VOLVER MENU" width="150" height="25" onMouseOver="src='menu/volverm2.jpg'"
onMouseOut="src='menu/volverm1.jpg'" border="0" /></a></p>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<!-- Center Column end -->
</div>

como podrias probar mi codigo para que veas el error ?


ojala me puedas ayudar lo que tu me muestras que funciona es lo que necesito pero por alguna razon no me funciona

Gracias