Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMartina Carrington
15,754 Pointsi finally fix suggest.php but the email post to work or it just a practice
question , for suggest.php when you fill out the forum on the website do the email post to work or just for practice . because it say Not Found
The requested URL /process.php was not found on this server.
Simon Coates
28,694 Pointsif there is an actual problem, you might want to put some source code at the forum.
Martina Carrington
15,754 Points@Simon Coates
<?php if($_SERVER["REQUEST_METHOD"] == "POST"){ $name = $_POST["name"]; $email = $_POST["email"]; $details = $_POST["details"];
echo "<pre>"; $email_body = ""; $email_body .= "Name " . $name . "\n"; $email_body .= "Email " . $email . "\n"; $email_body .= "Details " . $details . "\n"; echo $email_body; echo "</pre>";
//To Do: Send Email header("location:suggest.php?status=thanks"); }
$pageTitle = "Suggest a Media Item"; $section = "suggest";
include("inc/header.php"); ?>
<div class="section page"> <div class="wrapper"> <h1>Suggest a Media Item</h1> <?php if (isset($_GET["status"]) && $_GET['status'] == "thanks") { echo "<p>Thanks for the email! I’ll check out your suggestion shortly!</p>"; } else { ?> <p>If you think there is something I’m missing, let me know! Complete the form to send me an email.</p> <form method="post" action="process.php"> <table> <tr> <th><label for="name">Name</label></th> <td><input type="text" id="name" name="name" /></td> </tr> <tr> <th><label for="email">Email</label></th> <td><input type="text" id="email" name="email" /></td> </tr> <tr> <th><label for="name">Suggest Item Details</label></th> <td><textarea name="details" id="details"></textarea></td> </tr> </table> <input type="submit" value="Send" /> </form> <?php } ?> </div> </div>
<?php include("inc/footer.php"); ?>
Simon Coates
28,694 Pointsdo you have access to the markdown cheatsheet on that comment. You should be able to put the code into a code view, so people can read it more easily.
1 Answer
Simon Coates
28,694 PointsYOu're posting to process.php (see action="process.php")
Martina Carrington
15,754 PointsThanks Simon Coates , :D
Martina Carrington
15,754 Pointsit work!!!! Thanks Simon Coates
Simon Coates
28,694 PointsSimon Coates
28,694 PointsI'm not sure you should be seeing that message. You could try commenting out the send and seeing if the problem remains, which would indicate that the fault is with your code. The email send isn't fundamental to the sticky forms pattern, which is more about submitting to self, performing validation.