Commit 0b7b22f1 by pupi1985 Committed by Scott

Added a convenient function to fetch arrays from $_POST array

parent 3c46cb94
...@@ -973,6 +973,23 @@ ...@@ -973,6 +973,23 @@
return isset($_POST[$field]) ? preg_replace('/\r\n?/', "\n", trim(qa_gpc_to_string($_POST[$field]))) : null; return isset($_POST[$field]) ? preg_replace('/\r\n?/', "\n", trim(qa_gpc_to_string($_POST[$field]))) : null;
} }
function qa_post_array($field)
/*
Return an array for incoming POST field, or null if it's not defined.
While we're at it, trim() surrounding white space for each value and convert them to Unix line endings.
*/
{
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
if (isset($_POST[$field])) {
$result = array();
foreach ($_POST[$field] as $key => $value)
$result[$key] = preg_replace('/\r\n?/', "\n", trim(qa_gpc_to_string($value)));
return $result;
}
return null;
}
function qa_clicked($name) function qa_clicked($name)
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment