Welcome Guest, Not a member yet? Register   Sign In
Prevent null values on input post
#4

But what if an empty string is not wanted but NULL is?

If we want to make everyone happy then maybe something like this


PHP Code:
/**
 * Fetch an item from the POST array
 *
 * @param mixed $index Index for item to be fetched from $_POST
 * @param bool $xss_clean Whether to apply XSS filtering
 * @param bool $default_fail The value to return if $_POST[$index] is not set or is NULL
 * @return mixed
 */
 
public function post($index NULL$xss_clean NULL$default_fail NULL)
 {
 
    $value $this->_fetch_from_array($_POST$index$xss_clean);
 
    return isset($value) ? $value : (isset($default_fail) ? $default_fail NULL); 
 } 
Reply


Messages In This Thread
Prevent null values on input post - by jonathanq - 09-29-2017, 10:10 AM
RE: Prevent null values on input post - by dave friend - 09-29-2017, 07:47 PM



Theme © iAndrew 2016 - Forum software by © MyBB