PHP—;带有$\u GET Test的未定义变量
我在以下WP站点的侧栏中有一个表单- 以下是我用于结果页的部分代码:PHP—;带有$\u GET Test的未定义变量,php,wordpress,forms,variables,get,Php,Wordpress,Forms,Variables,Get,我在以下WP站点的侧栏中有一个表单- 以下是我用于结果页的部分代码: <?php if (isset($_GET['ApplianceType']) || isset($_GET['brand'])) : // search filter form ?> <?php query_posts($query_string . '&orderby=title&order=ASC') ?> <?php get_template_par
<?php if (isset($_GET['ApplianceType']) || isset($_GET['brand'])) : // search filter form ?>
<?php query_posts($query_string . '&orderby=title&order=ASC') ?>
<?php get_template_part('loop', 'feed-products' ); ?>
<?php wp_reset_query(); ?>
<?php else : // display categories as default ?>
<?php get_template_part('include', 'feed-categories-products' ); ?>
<?php endif; ?>
但是这个声明总是返回错误。最初,我没有使用isset()
函数,但这给了我未定义的变量错误
有人知道我做错了什么吗?你不一定做错了什么。如果在未进行
isset
-检查的情况下出现“undefined variable”(未定义变量)错误,则可能意味着$\u GET
数组中的ApplianceType
和brand
键未定义
它们要么被删除,要么根本就没有设置。刚刚发现,在这里有未定义的警告。您必须使用:
isset($_GET['Brand']) // you are using 'brand'
如果代码中只有PHP而没有其他语言,为什么每一行都包含
;打印(美元);;回声';让我们知道result@Riad谢谢,我已经试过了。它告诉我它是一个空阵列,我已经修复了,但不幸的是它仍然不能工作!