Ver Mensaje Individual
  #3 (permalink)  
Antiguo 10/01/2013, 09:31
Avatar de heryfer
heryfer
 
Fecha de Ingreso: febrero-2002
Ubicación: Valencia, España
Mensajes: 164
Antigüedad: 22 años, 2 meses
Puntos: 0
Respuesta: Enviar varialbes ocultas

Hola aqui te paso 2 funciones que te puede ayudar

function get_input($variable, $default = "", $sql_filter = true, $check_empty = true){
global $CONFIG;

if ( (isset($variable) && isset($_REQUEST[$variable]) && ( (is_array($_REQUEST[$variable]) && count($_REQUEST[$variable]) > 0 ) || trim($_REQUEST[$variable]) != "" || !$check_empty) ) || isset($CONFIG->input[$variable])) {

if (isset($CONFIG->input[$variable])) {

$var = $CONFIG->input[$variable];

}else{

if (is_array($_REQUEST[$variable])) {
$var = $_REQUEST[$variable];
} else {
$var = trim($_REQUEST[$variable]);
}

}



return $var;
}

if (is_array($_REQUEST[$variable]) && count($_REQUEST[$variable]) == 0){
$default = null;
}


return $default;

}


function set_input($variable, $value, $check_empty = false) {

global $CONFIG;

if (!$check_empty || ($value && trim($value) != "") ){

if (!isset($CONFIG->input))
$CONFIG->input = array();

if (is_array($value)){

foreach ($value as $key => $val)
$value[$key] = trim($val);

$CONFIG->input[trim($variable)] = $value;

}else{

$CONFIG->input[trim($variable)] = trim($value);
}

}

}

usos
set_input('id', '8');

$id = get_input('id');

ten en cuenta que la variable $CONFIG es global

Este método se utiliza mucho cuando el sitio web tiene url amigables entonces los parametros los pasas de esta manera.

Saludos