lundi 23 mars 2015

php loop through submitted form fields

I'm trying to set up an email response from a form that will send back the data that was submitted. So far, I have



$message= '';
foreach ($_POST as $key => $value)
{
$message .= $key . ': ' . $value . PHP_EOL;
}


but that shows all fields, not just the ones that have a value. Is there a way to show only name and value from submitted fields?


Aucun commentaire:

Enregistrer un commentaire