0
我有一個從文本文件生成的php列表。 而我有一些問題過濾信息的最大值。 這是我的代碼:比較列表和表格的值php
<?php
$searchReq = $_POST['searchMaximum'];
$intValForm = filter_var($searchReq, FILTER_VALIDATE_INT);
$f = fopen("info.txt", "r");
while (($line = fgets($f)) !== FALSE) {
if (strstr($line, $searchReq)) {
list($hPostcode, $hPrice, $hImage, $hViews) = explode(",", $line);
$intValFile = filter_var($hPrice, FILTER_VALIDATE_INT);
if($intValFile <= $intValForm){
print "<hr/>";
print 'Postcode:' . $hPostcode . '<br />';
print 'Price: £' .$hPrice . ",000" . '<br />';
print "<img src=\"$hImage\" />";
print 'Views:' . $hViews . '<br />';
print '<br/>';
}
}
}
fclose($f);
?>
所以它劃分四個場中的每一行,使一個變量out每個字段的。 我的問題是如何比較我從搜索框中獲得的值以及僅顯示行(打印字段)的頁面,其中相應的變量低於搜索到的值。 有人可以幫助我嗎? 我真的很感激:)
工程就像一個魅力。非常感謝你@ziollek – jPratas