Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/06/2013, 14:05
Avatar de hulray
hulray
 
Fecha de Ingreso: septiembre-2006
Mensajes: 630
Antigüedad: 17 años, 8 meses
Puntos: 3
problema al hacer un insert

buenas tardes, saben tengo este problema que no se porq me esta ocurriendo.

solo me esta guardando el id y el ultimo valor en la base de datos...

por favor necesito de su ayuda,


textoindex1.php
Código PHP:
<?
include('../config.php'); //incluimos el config.php que contiene los datos de la conexión a la db

$ok     false;
$error  "1";
$texto  "Error en el texto";

if( isset(
$form_submit) and !isset($submit_borrar) and !isset($submit_agregar) )

  {

//--> Datos Inspeccion
//-->

    
$r_id        trim(strip_tags($r_id));
    
$r_fecha     trim(strip_tags($r_fecha));
    
$r_hora      trim(strip_tags($r_hora));
    
$r_nick      trim(strip_tags($r_nick));
    
$r_usuario   trim(strip_tags($r_usuario));
    
$r_text      strip_tags      ($r_text);
    
    }
    
    
$msg "";
if (
$usuario == $session["name"]){
//Cajas de texto

$t_text $_POST['r_text'];

if (
$t_text == ""){
$msg="Debe completar los datos";
$completo "No";
}else 
$completo "Si";
}

if (
$completo == "Si"){
    
    
        
mysql_query("INSERT INTO textindex (fecha_text,hora_text,nick_text,nombre_text,text) values ('$r_fecha','$t_hora_text','$t_nick_text','$t_nombre','$t_text') ");
        echo 
$t_id_text ;
        echo 
$r_fecha_index_actual ;
        echo 
$t_hora ;
        echo 
$t_usuario ;
        echo 
$r_nombre ;
        echo 
$t_text;
        echo 
'Usuario registrado con éxito';

}


//--> Datos Inspeccion

//-->

    
$r_id              " Ingresar";
    
$r_fecha_index          date(Ymd);
    
$r_fecha_index_aa     substr($r_fecha_index,0,4);
    
$r_fecha_index_mm     substr($r_fecha_index,4,2);
    
$r_fecha_index_dd     substr($r_fecha_index,6,2);
    
$r_fecha_index_actual $r_fecha_index_dd."-".$r_fecha_index_mm."-".$r_fecha_index_aa;
    
$r_hora_index          =(date("H:i"));
    
$r_sesion              $session["name"];

    
    
$sql "SELECT * from users where nick='".$_SESSION["usuario"]."'";
    
    
$rs=mysql_query($sql);
    while(
$row=mysql_fetch_array($rs))
    {
    
//$r_id       = $row["id"];
    
$r_nombre   $row["nombre"];
    
$r_pass     $row["pass"];
    
$r_usuario  $row["nick"];
    
$r_mail     $row["email"];
    
$r_cargo    $row["rollo"];
    
$r_fecha    $row["fecha"];
    
$r_level     $row["level"];
    
$r_active    $row["active"];

            
$sql2="select * from textindex";
            
$rs2=mysql_query($sql2);
            while(
$row2=mysql_fetch_array($rs2))
            {
            
$t_id_text       $row2["id_text"];
            
//$t_fecha_text    = $row2["fecha_text"];
            
$t_hora_text     $row2["hora_text"];
            
$t_nick_text     $row2["nick_text"];
            
$t_nombre_text   $row2["nombre_text"];
            
//$r_text             = $row2["text"];
             
}
             }
include_once (
"textoindex2.php");

//$r_text_index=$_POST['text_index'];
//$r_text_index= "hola";

//}

?>
textoindex2.php
Código PHP:
<?php
include_once ("../menu.php");





?>
     </ul>
    </div>
   
    <div class="appsBody">
      <div class="appsBody">
        <p>&nbsp;</p>
      </div>
    </div>
</div>
  
  
  <div class="appsBody">
  <div class="topwrap_acceso"></div>
  <div class="wrapper">
    <p><?
echo 'Bienvenido ';
echo 
$r_nombre

?>.
    Agregue una noticia en la pagina index. 
   
   
  <form method="post" target="_parent">
  <input type="hidden" name="form_submit" value="ok">

   <?
   
   
echo "<input type =\"text\" name =\"r_id\" size=8 maxlength = 8 value=\"$r_id\">";
   echo 
"<input type =\"text\" name =\"r_fecha\" size=8 maxlength = 8 value=\"$r_fecha_index_actual\">";
   echo 
"<input type =\"text\" name =\"r_hora_index\" size=8 maxlength = 8 value=\"$r_hora_index\">";
   echo 
"<input type =\"text\" name =\"r_usuario\" size=8 maxlength = 8 value=\"$r_usuario\">";
   echo 
"<input type =\"text\" name =\"r_nombre\" size=8 maxlength = 8 value=\"$r_nombre\">";
   
//echo "<input type =\"text\" name =\"r_text\" size=8 maxlength = 8>";
  
  
echo "<textarea name=\"r_text\" id=\"t_text\"></textarea><br>";
  
  echo   
"<input type=\"submit\" name=\"form_submit\" value=\"Agregar\">";
?>



      </label>
      <p>  
</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
    </form>
    <p><br />
      <br />
      <br />
      </div>
    <div class="botwrap"></div>
  </div>
  <div class="general">
    <div class="footer">
    <?php
    
include_once ("../direccion.php");    
    
?>
    <br />
    <br />
    </a>  </div>
  </div>
</body>
</html>

muchas gracias.