Jump to content

using \n instead of <br> causes errors?


wright67uk

Recommended Posts

The code below returns the correct results, which are in this case are email addresses.

After each displayed value there is a br eg.  emai1@hotmail.com<br>email2@hotmail.com<br>email3@ etc.

So the quesion is, can i change the below codeing to prevent this.

I have tried changing

 $message .= "<br>". $row['email'] 

  to 

 $message .= "\n". $row['email']  

but this results in;

 

Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html

 


$code = $_GET['postcode'];
$message = $_GET['message'];
$emailad = "email@hotmail.co.uk";
$shortcode = substr($code,0,2);
$result = mysql_query("SELECT email FROM treesurgeons WHERE postcode like '%" . $shortcode . "%' ORDER BY companyName LIMIT 3")
or die(mysql_error());  
echo "<h2>Business Names:</h2>";                     
while ($row = mysql_fetch_array( $result )) 
{
$message .= "<br>". $row['email'] ;

}
echo "\n";
echo $message; 
mail( "$emailad", "Header","$message" );
echo "<br>" . "Thank you for using our mail form.";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.