I have a contact form that is working at the moment,i only get two notices:
Notice: Undefined variable: email_content Notice: Undefined variable: header
This is the code
// check if an error was found - if there was, send the user back to the form
if (isset($error)) {
$_POST['e'] = $error;
} else {
// write the email content <-- HERE IS WHERE THE ERROR OCCURS
$email_content .= "Naam:" . htmlspecialchars($name, ENT_QUOTES) . "\n\n";
$email_content .= "Tel:" . htmlspecialchars($tel, ENT_QUOTES) . "\n\n";
$email_content .= "E-mail:" . htmlspecialchars($email_address, ENT_QUOTES) . "\n\n";
$email_content .= "Onderwerp:" . htmlspecialchars($onderwerp, ENT_QUOTES) . "\n\n";
$email_content .= "Bericht:" . htmlspecialchars($message, ENT_QUOTES) . "\n\n";
/*
$email_content .= "Naam:$name\n\n";
$email_content .= "Tel:$tel\n\n";
$email_content .= "E-mail:$email_address\n\n";
$email_content .= "Onderwerp:$onderwerp\n\n";
$email_content .= "Bericht:$message\n\n";
*/
$header .= 'From: www.UTI.nl'; <-- AND HERE IS ALSO WHERE THE ERROR OCCURS
// send the email
mail ("robin2609@gmail.com", "Nieuw bericht van de UTI website", $email_content, $header ); <-- this is
// send the user back to the form
$_POST['s'] = 'Bedankt voor uw bericht.';
What am i missing? I hope you guys can help me.
Kind regards,
Robin
Because you are trying to append to an undeclared string in $email_content
& $header
.
On your first lines of each variable change the .=
to =