Hey guys, just wondering if you can help. I use alot of HTML and CSS. im just starting on jquery and PHP now. I am more of a designer than a coder, however I would like to be strong at both. I made a simple contact form, this is the HTML <form action="forum_process.php" method="post"> <p>first name <input name="first_name" type="text" id="first_name"> <p> last name <input name="last_name" type="text" id="last_name"> <p> email <input name="email" type="text" id="email"> <p> message <textarea name="message " id="message "></textarea> <p> <input name="submit" type="submit" id="submit"> <input name="reset" type="reset" id="reset"> </form> Code (markup): and this is the PHP: <?php $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $email = $_POST['email']; $message = $_POST['message']; $to = "christoffchisholm@gmail.com"; $subject = "new message"; mail ($to, $subject, $message, "from: " . $first_name . $last_name); echo "your message has been sent"; ?> PHP: I've googled but i just can't find the reason why, it sends the email, but it comes up completely blank. Very frustrating. Just when I thought I was getting somewhere. I would greatly appreciate the help, also the email address it sends through is really werid. and it sends it to spam and says its untrusted and blocks it. Thanks guys,
There are extra parameters you can send through to set the sender. Check out php.net/mail Because you haven't told who sent the email it just works out a default sender email from the server. Your spam filter recognises the default as a default and isn't impressed. Your form is pretty insecure and you will get spammed through it and some of it will be ugly. You may want to build some rules around what the message has to look like before you will send it. Things like no more than 1 hyperlink in the message, a local IP address.
Although the spam-filter might wreak havoc based on the missing sender-email, but that doesn't really explain the empty received email. The HTML-code isn't very good either, since you're missing label-tags etc. What you should do is comment out the mail()-function, and just try to output the content arriving from the form - just do a print_r($_POST) and check to see if everything is arriving.
how about fix this. see at the textarea. <textarea name="message " id="message "></textarea> HTML: at the name parameter, the value had space on it. try to remove it.