Hi

How do I strip the </ br> from the database when a carriage return is entered into the text area by a user?
I get something like this:
hello<br />
<br />
hello<br />
<br />
hello

In addition when using the php mail() function, the text area also stores the </ br> and shows it back to the user in their email: This is the rqst_content field.

if (isset($_POST['submit'])) 
    {        
     $rqst_name = mysqli_real_escape_string($dbc, trim($_POST['rqst_name']));
     $rqst_email = mysqli_real_escape_string($dbc, trim($_POST['rqst_email']));
     $rqst_number = mysqli_real_escape_string($dbc, trim($_POST['rqst_number']));
     $rqst_content = nl2br(trim($_POST['rqst_content']));
     $rqst_survey = mysqli_real_escape_string($dbc, trim($_POST['rqst_survey']));
     $http_referrer = getenv( "HTTP_REFERER" );

//send email

    //$to = 'liz.banbury@gmail.com';
    $to = $rqst_email.',enquiries@bright-tutors.com,liz.banbury@gmail.com';
    $subject = 'Bright-Tutors - General Enquiry';
    $msg = "$rqst_name has contacted Bright-Tutors.\n" .
    "This message was sent from:\n" .
    "$http_referrer\n" .
    "------------------------------------------------------------\n" . 
    "Contact Email Address: $rqst_email \n" .
    "------------------------------------------------------------\n" . 
    "Contact Number: $rqst_number \n" .
    "------------------------------------------------------------\n" . 
    "How Did You Hear About Us?: $rqst_survey \n" .
    "------------------------------------------------------------\n" . 
    "Comments: $rqst_content" ;


    $headers = "From: admin@bright-tutors.com" ;

    mail($to, $subject, $msg, $headers);

Any help would be much appreciated.

THanks you

Hi,
If there is no processing done on the form itself, textarea input should not contain <br /> tags. If the question is a Wordpress one (e.g. solved by the link from Bachov) then I'll bow out. If not, there's a process I have developed for dealing with breaks and slashes for textarea input then database entry then output to html or email. I found slashes the hardest to deal with for line breaks. Let me know if the Bachov link didn't apply to your problem.

Hi. Yes it is not a wordpress issue and I'm still having problems with textarea and getting line breaks stored with the hard-coded </ br> in the database....

Can't you just remove the line-breaks BEFORE inserting into the database? a str_replace() should do the trick.

Are you using an html editor attached to your textarea? Pressing return in a text area doesn't enter a br tag unless something else is generating it.

OK I've sorted that. just removed nl2br() from the insert and left it in the echo output.

Now I'm just left with the mail() function above.
$rqst_content = nl2br(trim($_POST['rqst_content']));
"Comments: $rqst_content" ;

It is when the "Comments: $rqst_content" ; shows in the email that it has the </ br>

I have solved the contact form by changing the following:
$rqst_content = nl2br(trim($_POST['rqst_content']));
to
$rqst_content = trim($_POST['rqst_content']);

Since you are sending plain text email (not html) you need to remove the nl2br function from the $rqst_content. No need to convert from new lines to br tags unless you are outputting html.