I have the following code to parse a form submitted in EE:
foreach ($fields as $f)
{
if(isset($_POST[$f]) {
$$f = $this->EE->input->post($f);
$$f = $this->EE->security->xss_clean($$f);
$clean_data[$f] = $$f;
}
}
Not all members in the $fields array may be present in the post.
Does that raise an exception if the field doesn't exist or will it go ahead and create a member in $clean_data for the missing postvar?
If so, would this be a simplification of the entire loop above?
foreach ($fields as $f)
{
$$f = $this->EE->input->post($f, true);
$clean_data[$f] = $$f;
}
The $fields array is needed to post to a web service. All fields are required in the $fields array but they may not be present in the post.