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 trialvelochicdunord
4,816 PointsGetting an error regarding "isset"
This is the code I wrote.
<?php
function my_plugin_options_page() {
if (!current_user_can('manage_options')) {
wp_die('You do not have sufficient permissions to access this page.');
}
global $plugin_url;
if ( isset ( $_POST[ 'my_plugin_form_submitted' ])){
$my_plugin_hidden_field = esc_html($_POST[ 'my_plugin_form_submitted' ]);
if($my_plugin_hidden_field == 'Y'){
$my_plugin_username = esc_html($_POST[ 'my_plugin_username' ]);
}
}
}
?>
I'm getting an error regarding my conditional if statement - that I don't have the "isset" structured correctly. I've been looking it over for twenty minutes - what am I missing? I checked the code at http://phpcodechecker.com/ and it comes back with no errors.
velochicdunord
4,816 PointsPaul - The message was with a red "Bummer!" and the x-in-a-circle - it was reading as an error.
I moved forward and used my code in the next step - where it was quite acceptable. Not sure what's going on.
Paul Crow
21,558 PointsPaul Crow
21,558 PointsIs it an error and not a warning? Try removing the spacing around your isset?