This code is not online. I am in the testing stages to see if this even works. 2 files shown below test-email.htm and test-email2.php
Thanks
HTML Code:
<HTML>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>League Signup</title>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<style type="text/css">
label {
color: black;
font-family: arial;
font-size: 22px;
}
input {
background-color: #ffffcc;
font-family: arial;
font-size: 22px;
border: 1px;
color: blue;
}
button {
color: blue;
font-size: 22px;
height: 32px;
width: 200px;
margin-left: 8%;
}
</style>
</head>
<body>
<form id="emailblast" method="post" action="test-email2.php">
<fieldset style="border:0px">
<p>
<label>Enter your Email Address:</label>
<input type="text" id="xemail" name="xemail" size="40" maxlength="40" required="required" />
</p>
<p>
<label>Enter the Subject of your email:</label>
<input type="text" id="xsubject" name="xsubject" size="40" maxlength="40" required="required" />
</p>
<p>
<label>Enter the Message of your email:</label>
</p>
<p>
<textarea id="xmessage" name="xmessage" rows="20" cols="40" wrap="hard" required="required" /></textarea>
</p>
<p>
<button type="submit" class="button">Submit</button>
</p>
</fieldset>
</form>
</body>
</html>
test-email2.php
PHP Code:
<?php
$myemail = filter_input(INPUT_POST, "xemail");
$subject = filter_input(INPUT_POST, "xsubject");
$message = filter_input(INPUT_POST, "xmessage");
try
{
$connect = new PDO('mysql:host=localhost;dbname=xxxx', "xxxx", "xxxx");
$connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sth = $connect->prepare("SELECT email FROM contacts WHERE lastname LIKE 'Col%' ");
$sth->execute();
$result = $sth->fetchAll(PDO::FETCH_COLUMN, 0);
$to = implode(", ", $result);
$connect = null;
} // end try
catch(PDOException $e)
{
echo 'ERROR: ' . $e->getMessage();
}
$headers = "From: $myemail\n";
print "$message";
// mail($to,$subject,$message,$headers);
// header("Location: index.htm");
?>
Bookmarks