how to capture all fields in the $_POST VARIABLE?
into an array?
$email = $_POST;
$emails = array_keys($email);
foreach($emails as $email) {
If you want to capture a list from a POSTed form, then use the array syntax trick instead of enumerated input field names:
This way you need no guessing in PHP, because emails[] becomes an array implicitely then:
print_r($_POST["emails"]);
foreach ($_POST["emails"] as $email) {
For database-escaping just use:
$db_emails = array_map("mysql_real_escape_string", $_POST["emails"]);
// that's an array too