ok, on bech100's post, i tried that, but it didnt work. I am trying to make a control panel where i type something in in the text area and it sends to all the users in the DB. Using his code, this is what i've got.
<form method="post" action="<?php echo $PHP_SELF?>">
<p><textarea rows="7" name="tidbit" cols="38"></textarea></p>
<p> </p>
<p><input type="submit" value="submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
<?
if ($submit) {
mysql_connect("localhost","myname","mypass") or die ("Unable to connect to MySQL server.");
$db = mysql_select_db("DB name") or die ("Unable to select requested database.");
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$to .= $line['email'].",";
}
$to = substr($to, 0, -1);
$subject = "Your weekly TidBit";
$message = $tidbit;
$headers = "From:
webmaster@tidbitfacts.com";
mail($to, $subject, $message, $headers);
} ?>
Obviously i have replaced the info used in connecting to the DB with the actual info. What should I change??