wolocaw Posted May 2, 2012 Share Posted May 2, 2012 Help! I'm stuck! This is the feedback form file I made. <html> <head><title>Bob's Auto Parts - Customer Feedback</title></head> <body> <h1>Customer Feedback</h1> <p>Please tell us what you think.</p> <form action="processfeedback.php" method="post"> <p>Your name:<br/> <input type="text" name="name" size="40" /></p> <p>Your email address:<br/> <input type="text" name="email" size="40" /></p> <p>Your feedback:<br/> <textarea name="feedback" rows="8" cols="40" wrap="virtual" /></textarea></p> <p><input type="submit" value="Send feedback" /></p> </form> </body> </html> And this is the process feedback file I made. <?php //create short variable names $name = trim($_POST['name']); $email = trim($_POST['email']); $feedback = trim($_POST['feedback']); //set up some static information $toaddress = "wolocaw@localhost"; $subject = "Feedback from web site"; $mailcontent = "Customer name: ".$name."\n". "Customer email: ".$email."\n". "Customer comments:\n".$feedback."\n"; $fromaddress = "From: [email protected]"; //invoke mail() function to send mail mail($toaddress, $subject, $mailcontent, $fromaddress); ?> <html> <head> <title>Bob's Auto Parts - Feedback Submitted</title> </head> <body> <h1>Feedback submitted</h1> <p>Your feedback (shown below) has been sent.</p> <p><?php echo nl2br($mailcontent); ?> </p> </body> </html> After I fill out the form, it brings me to a page that says "Feedback submitted" at the top and "Your feedback (shown below) has been sent." below it. And that's it. nl2br($mailcontent) doesn't do anything. What am I doing wrong? I don't understand! Quote Link to comment https://forums.phpfreaks.com/topic/261934-customer-feedback-form/ Share on other sites More sharing options...
WebStyles Posted May 2, 2012 Share Posted May 2, 2012 That script works fine (just tested on my server). Maybe it's an smtp problem? Quote Link to comment https://forums.phpfreaks.com/topic/261934-customer-feedback-form/#findComment-1342188 Share on other sites More sharing options...
wolocaw Posted May 2, 2012 Author Share Posted May 2, 2012 Oh. Haha. I am such a newbie. Instead of using the form by typing in localhost/file location into the browser, I was using it by double clicking the html file. Thanks for looking over my code though! This site is awesome. I'll be back for sure! Quote Link to comment https://forums.phpfreaks.com/topic/261934-customer-feedback-form/#findComment-1342198 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.