contact form

8 months 1 week ago #690 by magne
contact form was created by magne
if (isset($_POST["submit"])) {
$name = $_POST;
$email = $_POST;
$message = $_POST;
$number = $_POST;
$from = 'Ny melding sendt fra kontaktskjema på';
$to = '[email protected]est';
$subject = 'Helsespesialisten | Du har motatt en ny melding';

$headerFields = array(
"From: $from",
"MIME-Version: 1.0",
"Content-Type: text/html;charset=utf-8"

$body = "Fra: $name\n E-post: $email\n Telefonnummer: $number\n Melding: $message\n";

// Check if name has been entered
if (!$_POST) {
$errName = 'Vennligst skriv inn ditt navn';

// Check if email has been entered and is valid
if (!$_POST || !filter_var($_POST, FILTER_VALIDATE_EMAIL)) {
$errEmail = 'Vennligst skriv inn din e-post';

//Check if message has been entered
if (!$_POST) {
$errNumber = 'Vennligst skriv inn ditt telefonnummer';

//Check if message has been entered
if (!$_POST) {
$errMessage = 'Vennligst skriv en melding';

// If there are no errors, send the email
if (!$errName && !$errEmail && !$errNumber && !$errMessage) {
if (mail ($to, $subject, $body, implode("\r\n", $headerFields))) {
$result='<div class="alert alert-success">Takk for din henvendelse! Vi tar kontakt i løpet av kort tid!</div>';
} else {
$result='<div class="alert alert-danger">Beklager, en feil skjedde! Kontakt oss på: +47 35 11 15 40</div>';

Please Logg inn or Create an account to join the conversation.

Moderators: Kai
Time to create page: 0.222 seconds
Powered by Kunena Forum