我不断收到以下错误消息
Notice: Undefined index: txtSearch in /var/www/vhosts/numyspace.co.uk/web_users/home/~unn_w11023553/public_html/holiday/searchprocess.php on line 11
Warning: SimpleXMLElement::xpath() [simplexmlelement.xpath]: Invalid expression in /var/www/vhosts/numyspace.co.uk/web_users/home/~unn_w11023553/public_html/holiday/searchprocess.php on line 22
Warning: SimpleXMLElement::xpath() [simplexmlelement.xpath]: xmlXPathEval: evaluation failed in /var/www/vhosts/numyspace.co.uk/web_users/home/~unn_w11023553/public_html/holiday/searchprocess.php on line 22
Warning: Invalid argument supplied for foreach() in /var/www/vhosts/numyspace.co.uk/web_users/home/~unn_w11023553/public_html/holiday/searchprocess.php on line 26
Title
然后我尝试运行我的搜索文件
<?php
include('functions.php');
$header = makeHeader();
// create an instance
$holidayDoc = simplexml_load_file('http://numyspace.co.uk/~unn_w11023553/holiday/holidays.xml');
// set $studytype to either the upper case request or null
$txtSearch = $_GET["txtSearch"];
// set the query using the studytype
if (!is_null($txtSearch)) {
$qry = "//channel/item[description[contains(text(),\"$txtSearch\")]]";
}
else {
// blank search entered so all holidays are shown.
$qry = "/channel/'ALL'";
}
$holidays = $holidayDoc->xpath($qry); // do the xpath query LINE 17
// now loop through all the students
echo "<table border=\"1\">\n";
echo "<tr><td>Title</td></tr>\n";
foreach ($holidays as $holiday) //LINE 21
{
echo
echo <p><strong><a href = '$link'>'$holiday'</a></strong></p>
<p><small>$published</small></p>";
}
$footer = makeFooter();
?>
摆弄了大约 2 小时,但仍然无法找出我出错的地方,任何见解将不胜感激,谢谢。