Ok, forget all that before, I have changed the code and sorted a few things out with it..
Note: To fix the problem I had, i had to put the variables inside the function rather than outside!
Now onto the "mail()" function... In another script I have, I use this to inform people of there account details at the site ( www.xing-designs.com). I used this same code (changed to suit this script of course) and get the following message:
Code:
Email couldnt be sent because:
That's all it says... Heres the code:
PHP Code:
<?
function db_connect() {
// Define the database settings
$host = "localhost";
$user = "";
$pass = "";
$db = "";
@mysql_connect("$host", "$user", "$pass") or die("Could not connect to $db because: ".mysql_error());
mysql_select_db("$db") or die("Unable to select DB") or die("Could not select table $db because: ".mysql_error());
};
function error_check() {
// Get the information from the form
$subj = $_POST['subj'];
$author = $_POST['author'];
$message = $_POST['message'];
// Check it
if(strlen($subj) < 5) {
exit("The subject is too short!");
} else if(strlen($author) < 2) {
exit("Your name is too short!");
} else if(strlen($message) < 20) {
exit("That message is too short to send!");
}
};
function email_query() {
// Selecting the "email" row from the table
$query = mysql_query("SELECT email FROM test") or die("Could not do query because: ".mysql_error());
};
function mail_it() {
// These are the vaiables that we defined from the form
mail($email, $subj, $message) or die("Email couldnt be sent because: ".mysql_error());
};
?>
Can anyone help me solve this problem?
Cheers!
Last edited by feraira; 06-17-2005 at 06:18 PM..
|