Ver Mensaje Individual
  #3 (permalink)  
Antiguo 11/05/2012, 16:19
dlvogth
 
Fecha de Ingreso: abril-2012
Mensajes: 11
Antigüedad: 12 años
Puntos: 0
Respuesta: grabar e imprimir

the_web_saint muchas gracias por tu respuesta, he estado probando con el header location, pero no me funciona, estoy desde hace poco aprendiendo php, mas o menos me las lio yo solo, Ah! y sobre lo que no funciona supongo por el envio de datos a pantalla antes, si quieres posteo el formato que manejo.

bueno te posteo mi código:

Código PHP:
<?php
session_start
();
if(
$_SESSION["ok"]==true){
?>
<?php
include ("../conexion/conexion.php");

//$con=mysql_connect("localhost","root","") or die("Falla en Connexion");
//mysql_select_db("inventariodb",$con);
$ubicacion=mysql_query("select ubicacion from ubicacion",$con);
$nombre=mysql_query("select nombres from encargados",$con);
$nombre1=mysql_query("select apellidos from encargados",$con);
$sql=mysql_query("select MAX(id) from articulos1"$con);
while(
$sql_max mysql_fetch_row($sql))
{
$max=$sql_max[0];
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Ingresar Nuevos Articulos</title>
<meta http-equiv="Content-Language" content="English" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="../css/style.css" media="screen" />
<link rel="shortcut icon" href="../images/favicon.ico" type="image/x-icon">
<link rel="icon" href="../images/favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="css/jquery-ui-1.7.3.custom.css" />
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.7.3.custom.min.js"></script>
<script type="text/javascript">
jQuery(function($){
    $.datepicker.regional['es'] = {
        closeText: 'Cerrar',
        prevText: '&#x3c;Ant',
        nextText: 'Sig&#x3e;',
        currentText: 'Hoy',
        monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio',
        'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
        monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun',
        'Jul','Ago','Sep','Oct','Nov','Dic'],
        dayNames: ['Domingo','Lunes','Martes','Mi&eacute;rcoles','Jueves','Viernes','S&aacute;bado'],
        dayNamesShort: ['Dom','Lun','Mar','Mi&eacute;','Juv','Vie','S&aacute;b'],
        dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','S&aacute;'],
        weekHeader: 'Sm',
        dateFormat: 'yy-mm-dd',
        firstDay: 1,
        isRTL: false,
        showMonthAfterYear: false,
        yearSuffix: ''};
    $.datepicker.setDefaults($.datepicker.regional['es']);
});
 
    $(document).ready(function() {
           $("#datepicker").datepicker({ appendText: ' Haga click para introducir una fecha' });
        });
</script>

</head>
<body>

<div id="wrap">

<div id="header">
<h1>ISHIMA SRL</h1>
<h2>Sistema de Inventario</h2>
</div>

<div id="top"> </div>

<div id="content">

<div class="left"> 

<h2><a href="#"> Ingresar Nuevos Articulos</a> <?php  print "<font color='red'>".$_SESSION["user"]."</font>";?> <a href="../conexion/cerrarsesion.php">[Cerrar Sesion]</a></h2>
<div class="articles">
<form id="nuevoarticulo" method="post" action="Ingresar Articulos.php">
  <h3>&nbsp;</h3>
  <center>
    <h3>
    FORMULARIO DE INGRESO DE ARTICULOS</h3>
  </center>
 <hr>
  <table width="509" border="0" cellspacing="3">
    <tr>
      <td width="109">Codigo:</td>
      <td width="381"><label>
       <input type="text" name="id" maxlength="20" value="<?php echo $max+1;?>"/>
      </tr>
    <tr>
      <td>Asignado a:</td>
      <td><select name="encargado">
        <?php for ($l=0;$l<mysql_num_rows($nombre1);$l++)
    {
        
    
$encar mysql_result($nombre,$l,"nombres");
    
$encar1 mysql_result($nombre1,$l,"apellidos");
    echo 
"<option value=\"$encar $encar1\">$encar $encar1</option>";
    }
    
    
?>
      </select></td>
    </tr>
    <tr>
      <td>Ubicaci&oacute;n:</td>
      <td><select name="ubicacion">
        <?php for ($la=0;$la<mysql_num_rows($ubicacion);$la++)
    {
    
$ubi mysql_result($ubicacion,$la,"ubicacion");
    echo 
"<option value=".$ubi.">".$ubi."</option>";
    }
    
?>
      </select></td>
    </tr>
  </table>
  <p><a href="Nueva Ubicacion.php"></a></p>
  <hr>
   <p>&nbsp;</p>
  <center>
    <table width="518" border="0" cellspacing="3">
           <tr>
        <td width="125">Art&iacute;culo :</td>
        <td width="380" align="left"><label>
          <input type="text" name="articulo"  />
        </label></td>
       </tr>
      <tr>
        <td>Cantidad :</td>
        <td><label>
          <input type="text" name="cantidad"  />
        </label></td>
      </tr>
      <tr>
        <td>Precio Unitario:</td>
        <td><label>
          <input type="text" name="preciou"  />
        </label></td>
      </tr>
      <tr>
        <td>Marca:</td>
        <td><label>
          <input type="text" name="marca"  />
        </label></td>
      </tr>
      <tr>
        <td>Unidad de medida:</td>
        <td><label>
          <input type="text" name="unidad" />
        </label></td>
      </tr>
      <tr>
        <td>Fecha Entrada:</td>
        <td><label>
          <input type="text" name="entrada" id="datepicker" readonly="readonly" size="12" />
            </label></td>
      </tr>
   <tr>
        <td>Registrado por:</td>
        <td><label>
          <input type="text" name="registro" value="<?php  print $_SESSION["user"];?>" readonly="readonly"/>
        </label></td>
      </tr>
    </table>
    <h3>&nbsp;</h3>
    </center>
  <hr>

   <p>&nbsp;</p>
  <p>
    <input name="Guardar" type="submit" value="Guardar" />
    <label><input type="reset" name="Clear" id="Clear" value="Limpiar" />
</label>
  </p></form>
  <?php
if (isset($_POST['id']))
{
    if (
$_POST['id']!=""){
$qid=$_POST['id'];
$qencargado=$_POST['encargado'];
$qubicacion=$_POST['ubicacion'];
$qarticulo=$_POST['articulo'];
$qcantidad=$_POST['cantidad'];
$qpreciou=$_POST['preciou'];
$qmarca=$_POST['marca'];
$qunidad=$_POST['unidad'];
$qentrada=$_POST['entrada'];
//$qsalida=$_POST['salida'];
//$qretirado=$_POST['retirado'];
$qregistro=$_POST['registro'];


$x=mysql_query("insert into articulos1 values('$qid','$qencargado','$qubicacion','$qarticulo','$qcantidad','$qpreciou','$qmarca','$qunidad','$qentrada','$qregistro')",$con);     //,'$qsalida','$qretirado','$qregistro' '$qid',

echo "<br>Registro Guardado Correctamente<br>";
}else{
    echo 
"No introdujo el id de equipo";
}
}

?>
  <p>&nbsp;</p>

</div>


<h2>&nbsp;</h2>
<div class="articles"></div>

</div>

<div class="right"> 

<h2>Que desea hacer?</h2>
<p>&nbsp;</p>
<ul>
  
  <li><a href="index.php">Home</a></li>
  <li>Ingresar Articulos</li>
  <li><a href="Reporte.php">Reportes</a></li>
</ul>
<h2>&nbsp;</h2>
</div>

<div style="clear: both;"> </div>

</div>


<div id="bottom"> </div>

<div id="footer"> Sistema de Inventario  &copy; 
</div>
<?php
}else{
    
header("Location:http://localhost/Inventario/paginas/Iniciar Sesion.php");
    exit;
}
?>
</div>

</body>
</html>
Lo que deseo es que cuando presione guardar, registre en base de datos y me redirija a otra página o abra una ventana emergente.

Gracias.