
18/07/2008, 12:33
|
| | Fecha de Ingreso: abril-2003 Ubicación: Monterrey, Nuevo Leon Mex
Mensajes: 300
Antigüedad: 21 años, 11 meses Puntos: 3 | |
Problema con Array Hola, quisiera ver si me pueden ayudar en donde esta el error, quiero formar una matriz de captura por medio de array's , donde se va a capturar una cantidad, descripcion, precio unitario y total, ahorita el primer elemento del array si lo esta recogiendo pero al capturar el segundo elemento borra la matriz, no se porque ?
Código:
<!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>Sistema Integral..Formato de requisicion</title>
<style type="text/css">
<!--
body {
background-color: #FFFFD2;
}
.Estilo2 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 18px;
font-weight: bold;
}
.Estilo4 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #0000FF; }
.Estilo6 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #FF0000;
}
.Estilo7 {color: #006633}
.Estilo8 {
font-size: 10px;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.Estilo9 {
color: #006633;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
}
-->
</style>
</head>
<script>
function tabular(e,obj) {
tecla=(document.all) ? e.keyCode : e.which;
if(tecla!=13) return;
frm=obj.form;
for(i=0;i<frm.elements.length;i++)
if(frm.elements[i]==obj) {
if (i==frm.elements.length-1) i=-1;
break }
frm.elements[i+1].focus();
return false;
}
</script>
<body>
<?php
putenv('TZ=America/Monterrey');
$hoy= date('M j Y');
function array_recibe($url_array) {
$tmp = stripslashes($url_array);
$tmp = urldecode($tmp);
$tmp = unserialize($tmp);
return $tmp;
}
$sw=$_GET['sw'];
$par=$_POST['par'];
$can=$_POST['can'];
$dsc=$_POST['dsc'];
$pun=$_POST['pun'];
$tot=$_POST['tot'];
if($sw == '')
{
$par=array();
$can=array();
$dsc=array();
$puni=array();
$tot=array();
}
// echo"<link rel=\"StyleSheet\" href=\"../css/styles.css\" type=\"text/css\">";
echo"<table width=\"750\" border=\"0\" align=\"center\">"
. " <tr>"
. " <td width=\"111\" rowspan=\"2\"><div align=\"center\"><img src=\"../images/logo.png\" /></div></td>"
. " <td width=\"422\" rowspan=\"2\"><div align=\"center\"><span class=\"Estilo2\">Requisicion de Compra</span></div></td>"
. " <td width=\"109\"><span class=\"Estilo4\">Fecha Requisicion</span></td>"
. " <td width=\"90\" class=\"Estilo6\">$hoy </td>"
. " </tr>"
. " <tr>"
. " <td valign=\"middle\" class=\"Estilo4\"> </td>"
. " </tr>"
. " <tr>"
. " <td colspan=\"4\"><table width=\"730\" border=\"0\" align=\"center\" bgcolor=\"#FFFF9F\">"
. " <tr>"
. " <td width=\"86\" class=\"Estilo6\">Departamento</td>"
. " <td width=\"163\"><input name=\"fsur3\" type=\"text\" id=\"fsur3\" size=\"20\" maxlength=\"10\" /></td>"
. " <td width=\"85\" class=\"Estilo6\">Quien Solicita</td>"
. " <td width=\"207\"><input name=\"fsur2\" type=\"text\" id=\"fsur2\" size=\"30\" maxlength=\"10\" /></td>"
. " <td width=\"81\"><span class=\"Estilo6\">Fecha a Surtir</span></td>"
. " <td width=\"82\"><input name=\"fsur\" type=\"text\" id=\"fsur\" size=\"10\" maxlength=\"10\" /></td>"
. " </tr>"
. " <tr>"
. " <td colspan=\"6\"><fieldset> <legend>Partidas de la Requisicion</>"
."<form method=\"POST\" action=\"$php_self?par=$par[$i]&can=$can&dsc=$dsc&pun=$pun&tot=$tot&sw=1\" >"
." <table width=\"500\" border=\"0\" align=\"center\">"
. " <tr bgcolor=\"#CCCCCC\">"
. " <td width=\"22\"><div align=\"center\" class=\"Estilo9\">Partida</div></td>"
. " <td width=\"21\"><div align=\"center\" class=\"Estilo9\">Cant</div></td>"
. " <td width=\"205\" class=\"Estilo9\">Descripcion </td>"
. " <td width=\"115\"><div align=\"center\" class=\"Estilo9\">Precio Unitario</div></td>"
. " <td width=\"119\"><div align=\"center\" class=\"Estilo9\">Total</div></td>"
. " </tr>"
. " <tr class=\"Estilo9\">";
$i=0;
while ( $par[$i] <> 0) {
echo " <td>$par[$i]</td>"
. " <td>$can[$i]</td>"
. " <td>$dsc[$i]</td>"
. " <td>$pun[$i]</td>"
. " <td>$tot[$i]</td><br></tr>";
$i++; echo $i;
}
echo " <td><input value=\"$par[$i]\" onkeypress=\"return tabular(event,this)\" name=\"par[$i]\" type=\"text\" id=\"fsur4\" size=\"6\" maxlength=\"10\" /></td>"
. " <td><input value=\"$can[$i]\" onkeypress=\"return tabular(event,this)\" name=\"can[$i]\" type=\"text\" id=\"fsur4\" size=\"6\" maxlength=\"10\" /></td>"
. " <td><input value=\"$dsc[$i]\" onkeypress=\"return tabular(event,this)\" name=\"dsc[$i]\" type=\"text\" id=\"fsur5\" size=\"50\" maxlength=\"10\" /></td>"
. " <td><input value=\"$pun[$i]\" onkeypress=\"return tabular(event,this)\" name=\"pun[$i]\" type=\"text\" id=\"fsur6\" size=\"11\" maxlength=\"10\" /></td>"
. " <td><input value=\"$tot[$i]\" onkeypress=\"return tabular(event,this)\" name=\"tot[$i]\" type=\"text\" id=\"fsur7\" size=\"11\" maxlength=\"10\" /></td>"
. " </fieldset> "
. " </tr></table><input type=\"submit\" name=\"Submit\" value=\"Enviar\" />"
." <td align=\"center\"> </td>"
. " </td> </tr>"
. " <tr>"
. " <td colspan=\"6\"> </td>"
. " </tr>"
. " </table></td>"
. " </tr>"
. " <tr>"
. " <td colspan=\"4\"><table width=\"112\" border=\"0\" align=\"center\" bgcolor=\"#ffffd2\">"
. " <tr>"
. " <td width=\"25\"><img src=\"../images/regresar.png\" /></td>"
. " <td width=\"53\"> </td>"
. " <td width=\"20\"><div align=\"center\"><img src=\"../images/guardar.png\" width=\"20\" height=\"20\" /></div></td>"
. " </tr>"
. " </table></td>"
. " </tr>"
. "</table>";
?>
</body>
</html>
ver ejemplo www.contamax.com/menu/solcot.php
Gracias por la ayuda que me puedan brindar. |