Hey all!
Was wondering if anybody could help me with this problem. I am attempting to search a URL for specific criteria and display the results of the search on the same page.
I have two files which I am working with: Index.php and WebSearch.inc.php class.
Index.php consists of the following form and results area:
<?php
define ("AUTHOR", "Me");
require_once("WebSearch.inc.php");
$search = new WebSearch ();
?>
<form method="GET" action="<?=$_SERVER['PHP_SELF']?>">
<div id="searchBox">
<table id="searchDetails">
<tr><td>Search Term</td><td><input class="text" name="term" type="text" value="some criteria" /></td></tr>
<tr><td>Website</td><td><input class="text" name="url" type="text" value=" /></td></tr>
<tr><td>Search Depth</td><td><select name="depth">
<option value="1">1</option>
<option value="2">2</option>
<option value="3" selected>3</option>
<option value="4">4</option>
<option value="5">5</option>
</select></td></tr>
</table>
<input type="submit" value="start search" />
</div>
</form>
<?php $results = $search->return_result(); ?>
<h2>Showing <?=count($results)?> results</h2>
<div id="resultsBox">
<?php foreach ($results as $result) { ?>
<div id="result">
<h3 class="title"><?=$result['title']?></h3>
<em class="date"><?=$result['date']?></em>
<p class="desc"><?=$result['content']?></p>
<span class="url"><?=$result['url']?></span>
</div>
<?php } ?>
The WebSearch.inc.php class I have managed to get this far:
<?php
class WebSearch
{
public function set_url ($url)
{
}
public function set_term ($search)
{
}
public function return_result ()
{
$result = array();
/* Fake Results */
for ($i=0; $i<10; $i++)
$result[$i] = array (
"title" => ($i+1).": Page Title",
"date" => "Date Found: 15.08.06 00:00:00",
"content" => "Content. More content. Some more content.",
"url" => " );
return $result;
}
}
?>
Would somebody be able to advise me about which direction that I need to take?
Thanks
Was wondering if anybody could help me with this problem. I am attempting to search a URL for specific criteria and display the results of the search on the same page.
I have two files which I am working with: Index.php and WebSearch.inc.php class.
Index.php consists of the following form and results area:
<?php
define ("AUTHOR", "Me");
require_once("WebSearch.inc.php");
$search = new WebSearch ();
?>
<form method="GET" action="<?=$_SERVER['PHP_SELF']?>">
<div id="searchBox">
<table id="searchDetails">
<tr><td>Search Term</td><td><input class="text" name="term" type="text" value="some criteria" /></td></tr>
<tr><td>Website</td><td><input class="text" name="url" type="text" value=" /></td></tr>
<tr><td>Search Depth</td><td><select name="depth">
<option value="1">1</option>
<option value="2">2</option>
<option value="3" selected>3</option>
<option value="4">4</option>
<option value="5">5</option>
</select></td></tr>
</table>
<input type="submit" value="start search" />
</div>
</form>
<?php $results = $search->return_result(); ?>
<h2>Showing <?=count($results)?> results</h2>
<div id="resultsBox">
<?php foreach ($results as $result) { ?>
<div id="result">
<h3 class="title"><?=$result['title']?></h3>
<em class="date"><?=$result['date']?></em>
<p class="desc"><?=$result['content']?></p>
<span class="url"><?=$result['url']?></span>
</div>
<?php } ?>
The WebSearch.inc.php class I have managed to get this far:
<?php
class WebSearch
{
public function set_url ($url)
{
}
public function set_term ($search)
{
}
public function return_result ()
{
$result = array();
/* Fake Results */
for ($i=0; $i<10; $i++)
$result[$i] = array (
"title" => ($i+1).": Page Title",
"date" => "Date Found: 15.08.06 00:00:00",
"content" => "Content. More content. Some more content.",
"url" => " );
return $result;
}
}
?>
Would somebody be able to advise me about which direction that I need to take?
Thanks