Hi,
I would like some help with my contact form please.
It has multiple checkbox's where each checkbox is 1 or many email address taken from the mysql database.
I've only left in the checkbox code and taken out the message fields etc.
If you need more data tell me what and i can post it.
Here is the checkbox form layout:
<input type="checkbox" name="test1" id="test1" value="1" <?php echo (isset($_POST["test1"]))? "checked" : ""; ?> />
<input type="checkbox" name="test2" id="test2" value="1" <?php echo (isset($_POST["test2"]))? "checked" : ""; ?> />
PHP:
if(isset($_POST["submit"])){
if(!count($errors)){
$test1= (isset($_POST["test1"]))? 1 : 0;
$test2 = (isset($_POST["test2"]))? 1 : 0;
$sql = "";
if($_POST["test"] = 1){
$sql .= " AND ee.email_address = " . $test1;
}
// Get details
$details_qry = "
SELECT
ee.*
FROM
email_email AS ee
WHERE
ee.email_email_id != 0
AND
" . $sql;
$qry = $DB -> query($details_qry);
$DB -> query("
INSERT INTO
database (
test1,
test2
) VALUES (
" . $test1 . ",
" . $test2 . "
)
");
if($test1){
$email_message = "Hello " . $first_name . "\n\n";
@mail($row["test1"], "Hello", $email_message, "From: info@myemail.com ", "-f" . $SETTINGS["from_email"]);
}
}
}