Ver Mensaje Individual
  #8 (permalink)  
Antiguo 25/04/2016, 13:58
calel_leon
 
Fecha de Ingreso: febrero-2016
Mensajes: 48
Antigüedad: 9 años, 1 mes
Puntos: 0
Respuesta: Problema con variable externa

Cita:
Iniciado por petit89 Ver Mensaje
Muestranos el codigo completo de actualizar.php aqui debe estar el problema... para iniciar, estoy viendo que no compruebas tus variables POST, deberias verificarlas siempre... pero muestranos lo demas
resultado.php
Código PHP:
<?php
require_once("conexion.php");
require(
'funciones.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>RUTA Control</title>
<link href="css/estilos_basicos.css" rel="stylesheet" type="text/css" />
<link href="css/textos.css" rel="stylesheet" type="text/css" />
</head>

<body>
<?php

$ot 
$_POST["ot"];
//echo $ot; 

$resultado mysql_query("SELECT * FROM orden2 WHERE orden2_id=$ot",$con);
while(
$fila=mysql_fetch_array($resultado)){ ?>


<div id="principal">
  <div id="encabezado"><img src="imagenes/logo ruta.png" width="900" height="148" alt="logo" /></div>
  <div id="menu"><a href="orden.php"><img src="imagenes/ot.gif" width="225" height="46" alt="orden" /></a><a href="sector.php"><img src="imagenes/sector.gif" width="225" height="46" alt="sector" /></a><a href="producto.php"><img src="imagenes/prod.gif" width="225" height="46" alt="producto" /></a><a href="listar3.php"><img src="imagenes/listar.gif" width="225" height="46" alt="listar" /></a></div>
  <div id="contenido">
      <div class="texto">
        
          <h1>Orden de Trabajo: <?php echo $fila['orden2_id'];?></h1>
          <form id="form1" name="form1" method="post" action="actualizarot.php">
            <table width="600" border="1">
              <tr>
                <td width="150">Actividad</td>
                <td width="150" colspan="2"> 
                  <label for="actividad3"></label>
                  <input type="text" name="actividad" id="actividad3" readonly="readonly" value="<?php echo $fila['actividad'];?>" />
                <td width="150">Sector</td>
                <td width="150">
                <label for="sector3"></label>
                <input type="text" name="sector" id="sector3" readonly="readonly" value="<?php echo $fila['sector'];?>" />
            </tr>
              <tr>
                <td>Cuartel</td>
                <td colspan="2">
                 <label for="cuartel">
                    
                </label>
                <label for="cuartel2"></label>
              <input type="text" name="cuartel" id="cuartel2" readonly="readonly" value="<?php echo $fila['cuartel'];?>" /></td>
                <td>Fecha de Inicio</td>
                <td><label for="fechainicio"></label>
              <input type="text" name="fechainicio" id="fechainicio" readonly="readonly" value="<?php echo cambiar_a_normal2($fila['fecha_inicio']);?>"/></td>
            </tr>
              <tr>
                <td>Costo</td>
                <td colspan="2"><label for="costo"></label>
              <input name="costo" type="text" id="costo" readonly="readonly" value="<?php echo $fila['costo'];?>" /></td>
                <td>Trabajadores</td>
                <td><label for="trabajadores"></label>
              <input name="trabajadores" type="text" id="trabajadores" readonly="readonly" value="<?php echo $fila['trabajadores'];?>" /></td>
            </tr>
              <tr>
                <td>Producto</td>
                <td>
                  <label for="producto">
                    
                </label>
                <label for="producto2"></label>
              <input type="text" name="producto" id="producto2" readonly="readonly" value="<?php echo $fila['producto'];?>"/></td>
                <td>&nbsp;</td>
                <td>Aprobar
                  <input type="radio" name="radio" id="aprob" value="aprobada" />
              <label for="aprob"></label></td>
                <td>Correguir 
                  <input type="radio" name="radio" id="correg" value="correguir" />
              <label for="correg"></label></td>
            </tr>
              <tr>
                <td>Comentario</td>
                <td colspan="4"><label for="comentario"></label>
              <textarea name="comentario" id="comentario" cols="55" rows="5" ></textarea></td>
            </tr>
              <tr>
                <td colspan="5"> <center><input type="reset" name="button" id="button" value="Cancelar" />                  <input type="submit" name="button2" id="button2" value="Enviar" /> </center></td>
            </tr>
          </table>
          <?php ?>
          <input type="hidden" name="ot" id="ot" value"<?php echo $ot?>" />
      </form>
          <p>&nbsp; </p>
      </div>
   
  </div>
  <div id="pie">Ruta Control</div>
</div>
</body>
</html>
actualizar.php

Código PHP:
<?php
require_once("conexion.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>RUTA Control</title>
<link href="css/estilos_basicos.css" rel="stylesheet" type="text/css" />
<link href="css/textos.css" rel="stylesheet" type="text/css" />
</head>

<body>

<?php
$resultado 
$_POST["radio"]; 
$resultado2 $_POST["comentario"]; 
$ot2 $_POST["ot"];

?>

<div id="principal">
  <div id="encabezado"><img src="imagenes/logo ruta.png" width="900" height="148" alt="logo" /></div>
  <div id="menu"><a href="orden.php"><img src="imagenes/ot.gif" width="225" height="46" alt="orden" /></a><a href="sector.php"><img src="imagenes/sector.gif" width="225" height="46" alt="sector" /></a><a href="producto.php"><img src="imagenes/prod.gif" width="225" height="46" alt="producto" /></a><a href="listar3.php"><img src="imagenes/listar.gif" width="225" height="46" alt="listar" /></a></div>
  <div id="contenido">
      <div class="texto">
        
          <h1>Orden de Trabajo Actualizada</h1>
                     <?php "UPDATE orden2 SET estado='".$resultado."', comentario='".$resultado2."' WHERE orden_id=".$ot2
                echo 
"Datos actualizados correctamete";
                
?>
      <p>&nbsp; </p>
      </div>
   
  </div>
  <div id="pie">Ruta Control</div>
</div>
</body>
</html>

Última edición por calel_leon; 25/04/2016 a las 15:53