I have also tried adding a simple echo statement just before the query, it only ever prints it out once.
This is the code I am using:
The form
Code: Select all
<p>Subject<br />
<input type="text" name="subject" /><br />
Message<br />
<textarea name="message" rows="10" cols="45"></textarea><br />
<input type="submit" name="submit" value="Submit" />Code: Select all
$mail = new Mail();
$mail -> send_msg();Code: Select all
class Mail
{
var $msg; // Store any error/success messages
function __construct() { /* Dont do anything */ }
function send_msg()
{
// Send the message
mysql_query("INSERT INTO `mail`(`subject`, `message`)
VALUES('" . htmlentities($_POST['subject']) . "', '" . htmlentities($_POST['message']) . "')
") or die(mysql_error());
$this -> msg = '<p><span class="notice">Success</span>: mail sent successfully.</p>';
}
}
?>Does anyone have any ideas why this might be happening?
Thanks,
someberry