Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP] Formularz kontaktowy
Forum PHP.pl > Forum > Przedszkole
Sofokles
Witam,

Po napisaniu wiadomości typu:

Cytat
Tekst
Tekst
Tekst


Otrzymuję ją w skrzynce w takiej postaci:

Cytat
Tekst Tekst Tekst


Zamiast nowej linii robią mi się spacje.

Mógłby mi ktoś przerobić ten kod żeby wysłane wiadomości przychodziły takie jakie zostały wysłane w formularzu?

Dziękuję

Kod
<?php
/*
Credits: Bit Repository
URL: http://www.bitrepository.com/
*/

include dirname(dirname(__FILE__)).'/config.php';

error_reporting (E_ALL ^ E_NOTICE);

$post = (!empty($_POST)) ? true : false;

if($post)
{
include 'functions.php';

$name = stripslashes($_POST['name']);
$email = trim($_POST['email']);
$subject = stripslashes($_POST['subject']);
$message = stripslashes($_POST['message']);


$error = '';

// Check name

if(!$name)
{
$error .= 'Please enter your name.<br />';
}

// Check email

if(!$email)
{
$error .= 'Please enter an e-mail address.<br />';
}

if($email && !ValidateEmail($email))
{
$error .= 'Please enter a valid e-mail address.<br />';
}

// Check message (length)

if(!$message || strlen($message) < 15)
{
$error .= "Please enter your message. It should have at least 15 characters.<br />";
}


if(!$error)
{
$mail = mail(WEBMASTER_EMAIL, $subject, $message,
     "From: ".$name." <".$email.">\r\n"
    ."Reply-To: ".$email."\r\n"
    ."X-Mailer: PHP/" . phpversion());


if($mail)
{
echo 'OK';
}

}
else
{
echo '<div class="notification_error">'.$error.'</div>';
}

}
?>
Pyton_000
http://devdocs.io/php/function.nl2br
Sofokles
Co i gdzie mam wstawić?
Puszy
Używaj BBCode
  1. $mail = mail(WEBMASTER_EMAIL, $subject, nl2br($message),
  2. "From: ".$name." <".$email.">\r\n"
  3. ."Reply-To: ".$email."\r\n"
  4. ."X-Mailer: PHP/" . phpversion());
Sofokles
Przepraszam, następnym razem będę pamiętał.

Dziękuję serdecznie za pomoc! Wszystko działa smile.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.