Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6345667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:52:07+00:00 2026-05-24T20:52:07+00:00

I have a contact form script and when the user submits it, they get

  • 0

I have a contact form script and when the user submits it, they get an email and I get one. But there’s a problem with the “message” textarea in the HTML email. It puts it all in one line.

See how I type it out:

enter image description here

And then in the email sent to me (HTML) its all in one line:

enter image description here

As you can see it is all in one line. How can I get it to not be in this line?

This is my code:

<?php

// load the variables form address bar
$subject = $_POST["subject"];
$message = $_POST["message"];
$from = $_POST["from"];
$name = $_POST["name"];
$verif_box = $_POST["verif_box"];

// remove the backslashes that normally appear when entering " or '
$message = stripslashes($message);
$subject = stripslashes($subject); 
$from = stripslashes($from); 
$name = stripslashes($name);
$emailContent = "Hello Nathan,

".$name." is trying to contact WeeBuild Support. Here's what they submitted:
<br /><br />
<div style='background-color:#ccc;padding:10px;border:1px solid grey;'>

Name: <strong>".$name."</strong>
<br /><br />
Email: <strong>".$from."</strong>
<br /><br />
Subject: <strong>".$subject."</strong>
<br /><br />
Message: 
<br /><br />
<strong>".$message."</strong>
<br /><br /><br />
Their IP Address: <strong>".$_SERVER['REMOTE_ADDR']."</strong>

</div>
<br /><br />
To email them back, simply reply to this message.";


$emailContents = "Hello ".$name.",

Thank you for contacting WeeBuild Support! This email is to let you know that we have received your support request and that we will reply soon. 

For your record, here is what you submitted:

-----------------------------------------------------------------------------

Your Name: ".$name."

Your Email: ".$from."

Subject: ".$subject."

Message: 

".$message."

-----------------------------------------------------------------------------

In the meanwhile, make sure to add support@weebuild.biz to your contact list/safe senders list so our emails don't end up in your junk folder.


We will be with you shortly!

Kind regards,
WeeBuild Support Team
www.WeeBuild.biz";

$emailContent = stripslashes($emailContent);
$emailContents = stripslashes($emailContents);
$headers = "From: " . $from . "\r\n";
$headers .= "Reply-To: ". $from . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";


// check to see if verificaton code was correct
if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
    // if verification code was correct send the message and show this page
    mail("nathan@weebuild.biz", 'WeeBuild Contact Form: "'.$subject.'"', $emailContent, $headers);
    mail($from, 'Thank you for contacting WeeBuild Support!', $emailContents, "From: support@weebuild.biz");
    // delete the cookie so it cannot sent again by refreshing this page
    setcookie('tntcon','');
} else if(isset($message) and $message!=""){
    // if verification code was incorrect then return to contact page and show error
    header("Location: index.php?name=$name&subject=$subject&from=$from&message=".urlencode($message)."&wrong_code=true");
    exit;
} else {
    echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">
<html><head>
<title>Access Denied</title>
<style type=\"text/css\">
body {
font-family: Arial, sans-serif;
}
</style>
</head><body>
<h1>Access Denied</h1>
<p>This page cannot be accessed directly. The needed variables to submit were not provided.</p>
</body></html>";

    exit;
    }
?>

Note: $emailContent is the email that goes to me and $emailContents is the email that goes to the user.

I tried using the str_replace() and that just caused parsing problems and I could not get that to work. I’m sure I wasn’t using it right.

Can someone help me with this? Any help is highly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T20:52:08+00:00Added an answer on May 24, 2026 at 8:52 pm

    use nl2br();

    So edit this snippet

    Message: 
    
    ".$message."
    

    to

    Message: 
    
    ".nl2br($message)."
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a PHP contact form that submits data, and an email...: <?php $dbh=mysql_connect
I have one contact form, that send the email to one of Address selected
I have a contact form in my flash file with name/email/message fields which a
I have the following script which creates an email from a contact form: http://codeviewer.org/view/code:1b54
I have this little script to toggle a contact form when a button is
i have a contact form sending itself to me by email using ASP classic,
I have a contact form where the email is actually accessible in the source,
I have a contact form that can be hidden using .slideToggle() but I want
I have a simple contact form with Subject and Message that I want to
I have an Ajax contact form that links to a jquery file but for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.