I have the following code for a results page from a search form. How do I properly hyperlink the results bearing in mind that different results will have different hyperlinks.
<?
// Grab POST data sent from form
$field = @$_GET['field'] ;
$find = @$_GET['find'] ;
$searching = @$_GET['searching'] ;
//This is only displayed if they have submitted the form
if ($searching =="yes")
{
echo "<h2>Results</h2><p>";
//If they did not enter a search term we give them an error
if ($find == "")
{
echo "<p>You forgot to enter a search term";
exit;
}
// Otherwise we connect to our Database
mysql_connect("localhost", "name", "pass") or die(mysql_error());
mysql_select_db("db_name") or die(mysql_error());
// We preform a bit of filtering
$find = strtoupper($find);
$find = strip_tags($find);
$find = trim ($find);
//Now we search for our search term, in the field the user specified
$data = mysql_query("SELECT documentid,title,category FROM material WHERE upper($field) LIKE'%$find%' Limit 0,1");
//And we display the results
while($result = mysql_fetch_array( $data ) )
}
//This counts the number or results - and if there wasn't any it gives them a little message explaining that
$anymatches=mysql_num_rows($data);
if ($anymatches == 0)
{
echo "Sorry, but we can not find an entry to match your query<br><br>";
}
//And we remind them what they searched for
echo "<b>Searched For:</b> " .$find;
}
// Close the database connection
mysql_close();
?>
Firstly, why are you using GET with POST data?
Secondly, where are you trying to link to or where is the link you want to use coming from as there is nothing in your code?
Am truly a novice at this...I hope to one day look back and laugh at my mistakes...until then.. How would I display as a one link the documentid, title, category...etc.? And each document would require it's own unique hyperlink.
Am truly a novice at this...I hope to one day look back and laugh at my mistakes...until then.. How would I display as a one link the documentid, title, category...etc.? And each document would require it's own unique hyperlink.
We can only tell you how to implement it but you have to tell us what you need. Without that we cannot help you. It is also the same reply simplypixie gave to you.
Above is my current results page...basically I need "Customer Guide to Trash" to be hyperlinked so that the user can download the document associated with the title.
Above is my current results page...basically I need "Customer Guide to Trash" to be hyperlinked so that the user can download the document associated with the title.
We understand that but that doesn't give us the format. Try this
Bookmarks