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.  [email protected]<br>[email protected]<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 protected]";
$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
https://forums.phpfreaks.com/topic/226930-using-n-instead-of-causes-errors/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.