I used this code on my last website. i am now coding my site by myself and learning as I go. Could someone point out what I'm missing here? This is my HTML for the form <form method="post" action="send_mail.php" method="post"> <p></p> <p> <input name="name" type="text" id="name" value="" size="75" /> <p> <input name="email" type="text" id="email" value="" size="75" /> <p> <textarea name="details" rows="8" cols="65">Details about project and anything else you think I need to know!</textarea> <p><button type="submit">send</button> </p> </form> Code (markup): Now I guess this should be a contact.php page right? So it could "echo" back "mail sent successfully. Here's my send_mail.php page: <?php // Prep The message $eol = "\r\n"; $message = $eol; $message .= "Name: ". $_POST['name'] .$eol; $message .= "E-Mail: ". $_POST['email'] .$eol; $message .= "Details: ". $_POST['details'] .$eol; // Send if(mail('michele@eight84.com', 'Eight84 Website E-Mail', $message)) { $response = "E-Mail Successfully Sent"; } else { $response = "E-Mail Failed to Send"; } // Redirect header("Location: index.php?response=". $response); exit(); ?> Code (markup): I tried changing "header("Location: index.php?response=". $response);" to: header("Location: contact.php?response=". $response); but it isn't sending the "response" message just appears to refresh the page although it DOES send the email.
ive tried it on IE 8, firefox, and safari....am I missing something in the HTML? Whats the respond in the URL?
http://eight84.com/new/coding/contact.php yes it comes back in the URL with this "http://eight84.com/new/coding/contact.php?response=E-Mail%20Successfully%20Sent" but doesn't notify you on the page itself....like this one (bottom) www.eight84.com
if($response == 'E-Mail Successfully Sent') { Echo 'E-Mail Successfully Sent'; } PHP: or you could just handle all responses if($_REQUEST['response']) { echo $_REQUEST['response']; } PHP: i would recommend filtering your response variable though, ya know xss and other injections better safe than sorry even though it'll only effect them. add that to the page you are sending to (index.php)
your mail script has this code "header("Location: index.php?response=". $response);" right? or does it say "header("Location: contact.php?response=". $response);" if it is the contact.php one then i'd add it to contact.php.