hola tengo este codigo php que me tiene que traer un valor de un registro para modficiarlo pero al momento de dar no funciona osea no me lleva a esta pagina solamente me redirecciona a la misma.
   Código PHP:
    <?php
error_reporting (E_ALL ^ E_NOTICE);
session_start();
$userid = $_SESSION['userid'];
$username = $_SESSION['username'];
$dbadmin = $_SESSION['admin'];
mysql_query("SET NAMES'utf8'");
 
if ($username && $userid){
    
    if($dbadmin == 0){
    echo "Bienvenido Admministrador";
    }
    else echo "<script>
alert('Usted no es Usuario');
window.location= 'member.php';
</script>";
}
else
 
 
   echo  "<script>
alert('Porfavor inicie sesion para entrar a esta pagina');
window.location= 'login.php';
</script>
";
 
require("connect.php");
require("funciones.php");
 
 
 
$idunidad = getParam($_GET["id"], "-1");
$action = getParam($_GET["action"], "");
 
if ($action == "edit") {
    $idunidad = getParam($_POST["id"], "-1");
    $codigo = sqlValue($_POST["codigo"], "int");
    $codigodonante = sqlValue($_POST["codigodonante"], "int");
    $tipoplasma = sqlValue($_POST["tipoplasma"], "text");
    $centros = sqlValue($_POST["centros"], "text");
    $tipo = sqlValue($_POST["tipo"], "text");
    $fechaentrada = sqlValue($_POST["fechaentrada"], "text");
    $caducidad = sqlValue($_POST["caducidad"], "text");
    $baja = sqlValue($_POST["baja"], "int");
    $bajapor = sqlValue($_POST["bajapor"], "text");
    
    $sql = "UPDATE unidades SET ";
    $sql.= "codigo=".$codigo.",codigodonante=".$codigodonante.",tipoplasma=".$tipoplasma.",centros=".$centros.",tipo=".$tipo.",fechaentrada=".$fechaentrada.",caducidad=".$caducidad.",baja=".$baja.",bajapor=".$bajapor." ";
    
    $sql.= "WHERE id=".$idunidad;
    mysql_query($sql, $conex);
    header("location: usuarios.php");
}
 
$sql = "SELECT * FROM unidades WHERE id = ".sqlValue($idunidad, "int");
$queCent = mysql_query($sql, $conex);
$rsCent = mysql_fetch_assoc($queCent);
$total = mysql_num_rows($queCent);
if ($total == 0) {
    header("location: listar.php");
    exit;
}
?>    
  que me tiene que hacer un update lo mando llamar desde esta otra pagina  
 Código PHP:
    <?php
error_reporting (E_ALL ^ E_NOTICE);
session_start();
$userid = $_SESSION['userid'];
$username = $_SESSION['username'];
$dbadmin = $_SESSION['admin'];
$centros = $_SESSION['centros'];
 
require("connect.php");
mysql_query("SET NAMES'utf8'");
require("funciones.php");
$query = "SELECT * FROM unidades INNER JOIN users ON users.centros = unidades.centros  WHERE unidades.baja =(0)  and users.id= '$userid'  ORDER BY unidades.centros";
 
 
 
$queCent = mysql_query($query, $conex);
 
if ($username && $userid){
    
}else
   echo  "<script>
alert('Porfavor inicie sesion para entrar a esta pagina');
window.location= 'login.php';
</script>
";
 
?>    
   Código HTML:
 <!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>Listado de Unidades</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
       <link rel="stylesheet" href="css/estilom.css">
       <link rel="stylesheet" href="css/botones.css">
              <script type="text/javascript" src="js/funciones.js"></script>
</head>
<div style="width: 1200px; position: relative; margin-left: auto; margin-right: auto;">
<body>
<h1>Listado de  Unidades</h1>
<table class="h2" align="center" border="4" cellspacing="3" cellpadding="3">
  <tr>
     
    <th bgcolor="#e62727">Id</th>
    <th bgcolor="#e62727">Codigo de unidad</th>
    <th bgcolor="#e62727">Codigo de donante</th>
    <th bgcolor="#e62727">clase de sangre</th>    
    <th bgcolor="#e62727">centro peticionarios</th>
    <th bgcolor="#e62727">Tipo de sangre</th>
    <th bgcolor="#e62727">Fecha de entrada</th>
    <th bgcolor="#e62727">Caducidad</th>
    <th bgcolor="#e62727">Editar</th>
    <th bgcolor="#e62727">Eliminar</th>
  </tr>
  <?php while ($rsCent = mysql_fetch_assoc($queCent)) { ?>
  <tr>
    <td><?php echo $rsCent['id']; ?></td>
    <td><?php echo $rsCent['codigo']; ?></td>
    <td><?php echo $rsCent['codigodonante']; ?></td>
    <td><?php echo $rsCent['tipoplasma']; ?></td>
    <td><?php echo $rsCent['centros']; ?></td>
    <td><?php echo $rsCent['tipo']; ?></td>
    <td><?php echo $rsCent['fechaentrada']; ?></td>
    <td><?php echo $rsCent['caducidad']; ?></td>
    <td><a href="editar.php?id=<?php echo $rsCent['id']; ?>">Editar</a></td>
    <td><a href="#" onclick="delUnidad(<?php echo $rsCent['id']; ?>);">Eliminar</a></td>
  </tr>
  <?php } ?>
</table>
<script type="text/javascript">
function delUnidad(id) {
	if (window.confirm("Aviso:\nDesea dar de baja esta unidad?"))	{
		window.location = "darbajausers.php?action=del&id="+id;	
	}
}
</script>
   <a class="button button-blue" onclick="window.location='usuarios.php'"><span> ir al menu</span></a>
<p> </p>
</body>
</div>
</html>  pero al momendo de darle a eliminar me redireciona a la misma pagina tengo entendido que no me esta tomando valor en  
 Código PHP:
    $sql = "SELECT * FROM unidades WHERE id = ".sqlValue($idunidad, "int");
$queCent = mysql_query($sql, $conex);
$rsCent = mysql_fetch_assoc($queCent);
$total = mysql_num_rows($queCent);
if ($total == 0) 
    
  pero el mismo codigo lo utilizo en otra pagina y si me funciona algun error que noten? que llevo rato sin encontrar solucion :S
Grax de antemano.