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 trialNur Azila
3,938 PointsNotice: Undefined index: name in E:\phpSiteBasic\process.php on line 9
I can't seem to get the array info back even after using var_dump. The thing is im using my localhost and another software to do this. Its probably not the problem but I have tried using workspace and the code works fine but when I copied the same codes into my software (im using PhpStorm) these errors occurs:
array(0) { } Notice: Undefined index: name in E:\phpSiteBasic\process.php on line 9
Notice: Undefined index: email in E:\phpSiteBasic\process.php on line 10
Notice: Undefined index: details in E:\phpSiteBasic\process.php on line 11
Here are my codes for suggest.php:
<?php $pageTitle = "Suggest a Media Item"; $section = "suggest";
include("inc/header.php"); ?>
<div class="section page">
<div class="wrapper">
<h1>Suggest a Media Item</h1>
<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>
</div>
</div>
<?php include("inc/footer.php"); ?>
process.php: <?php var_dump($_POST); $name = $_POST["name"]; $email = $_POST["email"]; $details = $_POST["details"]; echo $name . $email . $details;
3 Answers
Nur Azila
3,938 Pointscalvin diguidig funny enough its actually due to PhpStorm's server issues, so i had to reinstall an older version of that IDE and now it works just fine. Thanks for pointing me in the right direction though :-)
calvindiguidig
Courses Plus Student 4,388 PointsTry to update your php installed on your local computer treehouse uses latest version of php that`s why some syntax not working on your local machine
Nur Azila
3,938 Pointscalvin diguidig hi i think u might be right, i tested the code online at phpfiddle.org and it works! but still i've checked my software, its up to date. the php version im using is 7.04 xampp. im not sure what else i can do. the code still would not work.
calvindiguidig
Courses Plus Student 4,388 PointsWell if its working to other and your php is updated it might be on a permission on the file try to chnage the access of your file make some researh for changing file access
Nur Azila
3,938 PointsNur Azila
3,938 PointsSo i researched a bit and got it to display the information but its not the same way as was taught by Alena. I had to use a $_GET instead of $_POST. It will be nice if someone could explain to me what went wrong because I still don't get it despite having the information displayed.