Reputation: 305
I tried debug on my Wordpress. It is showing following error
Notice: Undefined index: category_one_middle in restaurant-menu-wordpress/plugin-main.php on line 273
<input id="category_one_middle" type="text" name="restaurantmenu_options[category_one_middle]" value="<?php echo stripslashes($settings['category_one_middle']); ?>" /><p class="description">Type category one name here.</p>
How do I fix this error? Any idea?
Upvotes: 1
Views: 5109
Reputation: 8461
You can use the function isset()
.
Try to replace the php code within value
atribute with the following:
<?php echo isset($settings['category_one_middle']) ? stripslashes($settings['category_one_middle']) : ''; ?>
Also, keep in mind that any changes you make to the plugin files will be lost on its update.
More info about isset()
function on PHP manual.
A nice topic about Undefined index
notices here.
Upvotes: 2
Reputation: 642
You need to take a look at the plugin-main.php file , I'd start at line 273 as that's what your error said. Somewhere you are having an undefined index.
For instance, if you'd echo $_POST['someindex']
, and there is no $_POST['someindex']
, you'd get a undefined error.
someindex can be a counter too , commonly known as $i.
Upvotes: 0