Hey,
Ok below is the code for a script that works. I have a HTML form where the user inputs the Subject and Message.
Unfortunately if I put the following message in the form like this:
This is just a test.
Let's see how it works.
It comes out like this.
This is just a test.///Let's see how it works.
Anyone know how to get a new line instead of three lines?
<?php
$landps = array("database", "localhost", "user", "pass");
$database = $landps[0];
$host = $landps[1];
$username = $landps[2];
$password = $landps[3];
$table = 'distributors';
$Subject = trim ($Subject);
$Message = trim ($Message);
$URL = 'http://www.myurl.com';
mysql_connect ($host,$username,$password) or die ("Failed login.");
mysql_select_db ($database) or die ("Failed to access db.");
$Message = addslashes ($Message);
$_POST['name'] = 'Chris Mahon';
$From = $_POST['name'] . '<mail@myserver.com>';
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: $From\r\n";
$result = mysql_query("SELECT email FROM distributors");
while ($row = mysql_fetch_array($result))
{
$recipient = $row['email'];
mail ($recipient, $Subject, $Message, $headers) or die ("mail failure.");
}
header("Location: $URL");
?>