Pagina uno
   Código PHP:
    <?php    
    include ('config/control.php');
    $con = new control;             //variable de la clase control.php
    $conexion = $con->conectar();//variable local        
    
    $total_pro=$_POST['txt_total'];
    
    
 
        //------------------------------------------------------------------------------------------------------------------
    if($_POST['btn_guardar'])
    {
        if($total_pro==''  )
        {            
            echo "<script language=javascript>alert('Faltan llenar campos');location.href='registrar_usuario.php';</script>";    
        }
        else         
        {    
            $sql="INSERT INTO total VALUES('', $total_pro)";
            //echo  $sql;
            $con->insertar=mysql_query($sql,$conexion);
            echo "<script language=javascript>alert('total guardado');location.href='suma.php';</script>";
            unset($_SESSION['valores']);
        //    unset($_SESSION['valores'][array_search()]); 
        
            
            
            
        }
    }
    //---------------------------------------------------------------------------------------------------------------------------    
    
 
    
?> 
 
<?php
 
$borra=$_POST['elimina'];
 
if($_POST['btn_eliminar'])
    {
        if($borra=='' )
        {            
            echo "<script language=javascript>alert('Por Favor ingrese VALOR a borrar ');location.href='suma.php';</script>";    
        }
        else         
        {    
            
           //$borra= $_POST['elimina'];
           
           $clave = array_search($borra, $_SESSION['valores']);
           unset($_SESSION['valores'][$clave]);            
            
            
        }
    }
 
 
 
 
//echo $total;
 
?>
 
 
<html>
 
<head>
 <title> </title>
</head>
 
<body>
 
 
<form name="form1" method="post" action="suma1.php">
  <p>
    Cantidad:
      <input name="cantidad" type="text" value="">
    <input type=submit name=enviar value=envia>
    <label>    </label>
    <input name=numero type=hidden value=1> 
    <label> 
    <div align="center"><br>
      <br>
      <p>
      <label>
      <div align="center">
      <div align="left">Eliminar Valor:
        <input name="elimina" type="text" value="">
        <input type="submit" name="btn_eliminar" id="btn_eliminar" value="eliminar" />
      </div>
      </label>
      <div align="center">TOTAL
        <input name="txt_total" type="text" id="txt_total" value="<? echo $total; ?>" />
        <input type="submit" name="btn_guardar" id="btn_guardar" value="Guardar" />
      </div>
    
</form>
 
</body>
</html>   
  Pagina dos.  
 Código PHP:
    <?php
 
session_start(); 
$_SESSION['valores'][] = $_POST['cantidad'];
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>
 
<body>
<table width="60%" border="0" align="center">
  <tr>
    <td><form id="form1" name="form1" method="post" action="">
      <table width="100%" border="0">
        <tr>
          <td colspan="2">
         <?php
 
 
 
 
 
//$codigo=$_POST['codigo'];
 
 
switch($_POST['numero']) 
{ 
        case 1: 
              foreach ($_SESSION['valores'] as $subtotal) 
              { 
                 echo $subtotal."<br>";
                 
               } 
 
             $total=array_sum($_SESSION['valores']); 
             echo "---------------------<br>"; 
             echo $total; 
              
            
 
 
         include("suma.php"); 
         
            
         
    
     } 
    
     
?> </td>
          </tr>
        <tr>
          <td colspan="2"> </td>
          </tr>
        
        <tr>
          <td colspan="2"> </td>
          </tr>
        </table>
    </form></td>
  </tr>
  
  <tr>
    <td align="center"> </td>
  </tr>
  <tr>
    <td align="center" bgcolor="#003366"><p><br />
    </p></td>
  </tr>
</table>
</body>
</html>   
  Este es el codigo  cuando intento eliminar inserta un espacio en blanco y la segunda vez si lo elimina no se donde tenga el error...Gracias por tu colaboracion....
