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 trialJacob Wick
8,912 PointsHi! My email field is returning a blank string, regardless of what I do. I'm not sure how to resolve this. Any ideas?
I've already tried changing the input type to "email." Is there some kind of privacy setting on Chrome that is just blocking the email address?
<?php
$name = $_POST["name"];
$email = $_POST["email"];
$details = $_POST["details"];
var_dump($name, $email, $details);
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 your e-mail! 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="suggest.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="details">Details</label></th>
<td><textarea name="details" id="details"></textarea></td>
</tr>
<tr style="display:none">
<th><label for="address">Address</label></th>
<td><input type="text" id="email" name="email" /></td>
<p>Please leave this field blank.</p>
</tr>
</table>
<input type="submit" value="Send" />
</form>
<?php } ?>
</div>
</div>
1 Answer
Jacob Wick
8,912 PointsFound the answer to my own questions. First, I'd carelessly left the "id=" and "name=" for the honeypot "Address" field to "email." Second, I removed the / from the end of the input field for email. That finally returned the email. Now I can move on!
Emmanuel C
10,636 PointsEmmanuel C
10,636 PointsOne thing i noticed was that you have 2 input fields with that same id. html elements should never have the same ids, thats the point of having ids; it makes them unique.