I’m building a e-mail contact form for my website and I’ve gotten to the last bit. I’m rather new at this so if some of the things I say seem obvious forgive me but remember what you were like when you started!
Basically I have the form on my site and you click the Submit button and it sends the data to another .PHP file, standard issue as far as I know. It send the e-mail to me the way it’s supposed to but where the problem comes in is the success/failure messages. Before I go too much farther here’s my PHP:
<?php
if(isset($_POST['submit'])) {
$headers = 'MIME-Version: 1.0' . "
";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";
$headers .= 'From: ' . $_POST['name'] . ' <' . $_POST['email'] . '>' . "
";
$headers .= 'Bcc: ds.scottyarch@gmail.com' . "
";
$to = "ds.scottyarch@gmail.com";
$subject = "DSD website e-mail contact form";
$name_field = $_POST['name'];
$from = $_POST['email'];
$message = $_POST['message'];
$body = "From: $name_field
E-Mail: $from
Message:
$message";
echo "Data has been submitted to $to!";
mail($to, $subject, $body, $headers);
} else {
echo "blarg!";
}
?>
So basically when I load the page I get the “Data ahs been submitted to ds.scottyarch@gmail.com!” text just like I’m supposed to but now what I’m wondering is if there is a way for me to instead of showing a message it would redirect them to a page?
The other option is I’m wondering if I could lay this code out in between body tags of a fully laid out page? In order for me to go this route I’d need to be able to put more than just that little bit of text, I’d want to have some links, headers and a short paragraph, all on multiple lines with DIV tags so I can lay it all out with CSS. I’m not sure if this is even possible though.
Can someone recommend what they think would be my best option?