So I have a form being submitted, and I want to take the $_POST values and compare them to the values that're currently in a database. The form names for all input fields are all the same in the database and such to ensure looping.
Here's what I have - am wondering if I'm on the right track:
function proc_vals($row_data, $submit_data) { //$submit_data would be $_POST being passed through
$body_html = "";
foreach ($submit_data as $key => $value) {
if ($row_data[$key] !== $value) {
$body_html .= "<p style=\"color: red;\">$value</p>";
} else {
$body_html .= "<p>$value</p>";
}
}
return $body_html;
}
//now call it
mail($to, $subject, proc_vals($row_data, $_POST), $headers);
Thanks in advance!