Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/03/2006, 02:30
bettycues
 
Fecha de Ingreso: febrero-2006
Mensajes: 16
Antigüedad: 18 años, 2 meses
Puntos: 0
Formularios y Select

Hola a todos:

Tengo el siguiente codigo

Código PHP:
<?php
   $id_noticia
=$_GET['id_noticia'];
if (isset(
$id_noticia)){
   
$link mysql_connect("localhost""""");
   
$link2 mysql_connect("localhost""""");
   
mysql_select_db("becario2"); 
   
$sql "select * from noticias where id_noticia= $id_noticia" ;
   
$result mysql_query($sql);
   
$row=mysql_fetch_array($result);
   }
?>
<html>
<head>
   <title>Noticias</title>
</head>
<body>
<form method="post" action="modificando.php">
<p>Identificador Noticia: <input name="id_noticia" type="text" value="<?php echo $id_noticia;?>" /></p>
<p>Titulo : <input type="Text" name="titulo" value="<?php echo $row["titulo"];?> "/>
</p>Autor: <input type="Text" name="autor" value="<?php  echo $row["autor"];?>" /></br>  
</p>Texto: <input type="Text" name="texto" value="<?php  echo $row["texto"];?>" /></br>        
</p>Fecha: <input type="Text" name="fecha" value="<?php  echo $row["fecha"];?>" /></br>            
</p>Identificador Categoria:<select name="categoria"> 
<?php 
    $sql2 
"select * from categoria";
    
$result2 mysql_query($sql2);
            while(
$row2=mysql_fetch_array($result2)){
//                if($row2[nombre]=="")
                
echo "<option value='".$row2[id_categoria]."'>".$row2[nombre]."</option>";
        }
        
?>
        </select> 
<input type="Submit" name="Guardar" value="Guardar">
</form>
</body>
</html>
Necesitaria que en select que he metido para mostrar las categorias, me marque la que pertenece a la noticia, como seleccionada. Me estoy volviendo loca y no tengo ni idea de como se puede hacer. Creo q utilizando un if es la forma mas sencilla, pero exactamente no se q poner, asiq si alguien me puede ayudar, se lo agradeceria.

Un saludo a todos