I can't go through all the pages on my site and change the form in my html right now. I've been looking for a way to change the list.php to require the field so I can just overwrite that once. I've looked and looked and I've probably found the solution, but it always includes these other fields -- name, address, age, first born -- and I believe that when I remove them since I don't know php, I'm ruining the code by adding a space in the wrong place or a bracket or something like that.
My form code is:
<form action="list.php" method="post" style="margin:0px"><input id="email" type="text" name="email" size="13" value=" Mailing List" onFocus="this.value=''"><input type="submit" value=" Join "></form>
Here is my list.php code:
Code: Select all
<?php
$to = 'xxx@domain.com';
$subject = 'Mailing List';
$from = 'email@domain.com';
$message ='';
foreach($_POST as $name => $data)
{
if(is_array($data))
{
foreach($data as $datum)
$message .= $name . ": " . $datum . " \n";
}
else
$message .= $name . ": " . $data . " \n";
}
{
header("Location: http://www.domain.com/list.html");
}
# Attempt to send email
if(mail($to, $subject, $message, "From: $from"))
echo "Mail sent";
else
echo "Mail send failure - message not sent";
?>Many, many thanks if anyone can.