Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/02/2013, 20:29
Kirara
 
Fecha de Ingreso: octubre-2012
Mensajes: 40
Antigüedad: 11 años, 6 meses
Puntos: 0
falla con textarea

hola, estoy haciendo un formulario, donde da la opcion de actualizar datos, todos se muestran si ya existian para dar opcion a modificarlos, todos pasan menos los que son de tipo <textarea>
Aquí se piden los datos:

Código PHP:
echo"<form action=\"\" method=\"post\" enctype=\"multipart/form-data\" >";
if(isset(
$_POST["dist"])){

    echo
"<br><h2>Dist</h2><br>";
  echo
"<table width=\"337\" height=\"205\" border=\"1\">";
    echo
"<tr>";
     echo
" <th width=\"144\" scope=\"col\">Tipo</th>";
      echo
"<th width=\"47\" scope=\"col\">Costo</th>";
      echo
"<th width=\"52\" scope=\"col\">Impacto</th>";
    echo
"</tr>";
    echo
"<tr>";
      echo
"<th scope=\"row\">1</th>";
      echo
"<td><input type=\"text\" name=\"d_1_c\"></td>";
      echo
"<td><input type=\"text\" name=\"d_1_p\"></td>";
    echo
"</tr>";
    echo
"<tr>";
      echo
"<th scope=\"row\">2</th>";
      echo
"<td><input type=\"text\" name=\"d_2_c\"></td>";
      echo
"<td><input type=\"text\" name=\"d_2_p\"></td>";
    echo
"</tr>";
    echo
"<tr>";
      echo
"<th scope=\"row\">".$_POST['c_1']."</th>";
      echo
"<td><input type=\"text\" name=\"d_c1_c\"></td>";
      echo
"<td><input type=\"text\" name=\"d_c1_p\"></td>";
    echo
"</tr>";
    echo
"<tr>";
      echo
"<th scope=\"row\">".$_POST['c_2']."</th>";
      echo
"<td><input type=\"text\" name=\"d_c2_c\"></td>";
      echo
"<td><input type=\"text\" name=\"d_c2_p\"></td>";
    echo
"</tr>";
 echo
" </table><br><br>";
 echo
" Escriba el dist:";
  echo
"<p><textarea name=\"d_just\"  cols=\"70\" rows=\"5\"></textarea></p>";
  echo
"<input type='hidden' name='c_1' value='".$_POST['c_1']."'>";
  echo
"<input type='hidden' name='c_2' value='".$_POST['c_2']."'>";
  echo
"<input type='hidden' name='id value='".$_POST['id']."'>";
  echo
"<input type=\"submit\" name=\"guardar_dist\" value=\"Guardar\">";
}
 echo
"</form>"
Aquí se guardan:
Código PHP:
echo"<form action=\"\" method=\"post\" enctype=\"multipart/form-data\" >";
if(isset(
$_POST["guardar_dist"])){
if(
$conexion=conexion()){
 
$sql="SELECT id FROM dist WHERE id='$_POST[id]'";
 
$resultado=mysql_query($sql);
 if(
mysql_num_rows($resultado)==0){
 
$sql="INSERT INTO dist (d_1_c,d_2_c,d_c1_c,d_c2_c,d_1_p,d_2_p,d_c1_p,d_c2_p,d_just,id) VALUES ('$_POST[d_1_c]','$_POST[d_2_c]','$_POST[d_c1_c]','$_POST[d_c2_]','$_POST[d_1_p]','$_POST[d_2_p]','$_POST[d_c1_p]','$_POST[d_c2_p]','$_POST[d_just]','$_POST[id]')";
 if(!@
mysql_query($sql,$conexion)){
 echo 
'Error al insertar la información';}
 else{
 echo 
'Información insertada correctamente.'; }}
 else{
  echo
"<br>Ya se le han asignado valores a los dist";
 
$sql="SELECT d_1_c,d_2_c,d_c1_c,d_c2_c,d_1_p,d_2_p,d_c1_p,d_c2_p,d_just FROM dist WHERE id='$_POST[id]'";
  if(
$resultado=mysql_query($sql,$conexion)){
  
$datos=mysql_fetch_array($resultado);
    
    echo
"<br>En los campos del formulario se ven los valores actuales, si no los actualiza los valores se mantienen";

  echo
"<table width=\"337\" height=\"205\" border=\"1\">";
    echo
"<tr>";
     echo
" <th width=\"144\" scope=\"col\">Tipo</th>";
      echo
"<th width=\"47\" scope=\"col\">Costo</th>";
      echo
"<th width=\"52\" scope=\"col\">Impacto </th>";
    echo
"</tr>";
    echo
"<tr>";
      echo
"<th scope=\"row\">1</th>";
      echo
"<td><input type=\"text\" name=\"d_1_c\" value='$datos[0]'></td>";
      echo
"<td><input type=\"text\" name=\"d_1_p\" value='$datos[4]'></td>";
    echo
"</tr>";
    echo
"<tr>";
      echo
"<th scope=\"row\">2</th>";
      echo
"<td><input type=\"text\" name=\"d_2_c\" value='$datos[1]'></td>";
      echo
"<td><input type=\"text\" name=\"d_2_p\" value='$datos[5]'></td>";
    echo
"</tr>";
    echo
"<tr>";
      echo
"<th scope=\"row\">".$_POST['c_1']."</th>";
      echo
"<td><input type=\"text\" name=\"d_c1_c\" value='$datos[2]'></td>";
      echo
"<td><input type=\"text\" name=\"d_c1_p\" value='$datos[6]'></td>";
    echo
"</tr>";
    echo
"<tr>";
      echo
"<th scope=\"row\">".$_POST['c_2']."</th>";
      echo
"<td><input type=\"text\" name=\"d_c2_c\" value='$datos[3]'></td>";
      echo
"<td><input type=\"text\" name=\"d_c2_p\" value='$datos[7]'></td>";
    echo
"</tr>";
 echo
" </table><br><br>";
 
 
//AQUÍ NO SALE NAAAAAAAAAADA¡¡....ESTE ES EL PROBLEMA
 
echo" Dist que seleccionó y porque:";
  echo
"<textarea name='d_just' value='$datos[8]' cols='70' rows='5'></textarea>"
  } 
  echo
"<input type='hidden' name='c_1' value='".$_POST['c_1']."'>";
  echo
"<input type='hidden' name='c_2' value='".$_POST['c_2']."'>";
  echo
"<input type='hidden' name='id' value='".$_POST['id']."'>";
  echo
"<br><br><input type='submit' name='actualizar_dist' value='Actualizar'>";
 echo
"<br><input type='submit' name='cons' value='Continuar'>";
}
}
else{
echo 
'No se realizó la conexión.';
}
}
echo
"</form>"

Si guarda todo en la base de datos, pero a la hora de mostrar lo que ya estaba, no muestra nada, no se si sea la sintaxis, pero me ocurre lo mismo con otros espacios de textarea...

¿Alguien sabe que está mal?... GRACIAS¡¡