Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/09/2012, 07:02
Avatar de hulray
hulray
 
Fecha de Ingreso: septiembre-2006
Mensajes: 630
Antigüedad: 18 años, 6 meses
Puntos: 3
problema al guardar

mi problema es que me guardan los valores que vienen de los select, pero no me guarda el ultimo "textindex" porque ese valor lo escribo yo...
alguien me puede ayudar?


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

$r_id_index " Ingresar";

if((
$r_id_index == ' Ingresar') )
{

    
$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))
            {
            
//$r_id_index       = $row2["id_index"];
            
$r_fecha_index    $row2["fecha_index"];
            
$r_hora_index     $row2["hora_index"];
            
//$r_text_index     = $row2["text_index"];
             
}

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

include_once ("textoindex2.php");
if((
$r_text_index == '') )


mysql_query("INSERT INTO textindex (fecha_index,hora_index,nombre,nick,text_index) values ('$r_fecha_index_actual','$r_hora_index','$r_nombre','$r_usuario','$r_text_index') ");
echo 
$r_fecha_index_actual ;
echo 
$r_hora_index ;
echo 
$r_nombre ;
echo 
$r_usuario ;
echo 
$r_text_index;
echo 
'Usuario registrado con éxito';
}
}

?>
textoindex2.php
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sicos LTDA</title>
<link href="../estilo_sicos.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
#Layer1 {
    position:absolute;
    left:877px;
    top:225px;
    width:223px;
    height:25px;
    z-index:11;
}
.Estilo1 {color: #FFFFFF}
-->
</style>
</head>
<body class="home">
<div class="general";> 
<div class="appsHeader">
  <p>  <td width="761" valign="top">
    <div align="center">
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="933" height="135">
        <param name="movie" value="logo.swf" />
        <param name="quality" value="high" />
        <embed src="logo.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="933" height="135"></embed>
      </object>
    </div></td></p>
  
</div>
<div class="appsBody">
      <div class="menu">
     <ul>
<?php
include_once ("../menu.php");


$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"));



?>
     </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" action="textoindex1.php?id_index=<? echo $r_id_index?>">

   <?
   
   
echo "<input type =\"text\" name =\"r_id_index\" size=8 maxlength = 8 value=\"$r_id_index\">";
   echo 
"<input type =\"text\" name =\"r_fecha_index\" 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_nombre\" size=8 maxlength = 8 value=\"$r_nombre\">";
   echo 
"<input type =\"text\" name =\"r_usuario\" size=8 maxlength = 8 value=\"$r_usuario\">";
   echo 
"<input type =\"text\" name =\"r_text_index\" size=8 maxlength = 8>";
  
 
//echo "<textarea name=\"r_text_index\" id=\"r_text_index\"></textarea><br>";
  
  
echo   "<input type=\"submit\" name=\"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 a todos!!!