Jump to content

search result to link?


adzie

Recommended Posts

sorry thought i'd posted it all

 

here goes

 

 

<h2>Search</h2>

<form name="search" method="post" action="<?=$PHP_SELF?>">

Seach for: <input type="text" name="find" /> in

<Select NAME="field">

<Option VALUE="name">Name</option>

<Option VALUE="email">Email</option>

</Select>

<input type="hidden" name="searching" value="yes" />

<input type="submit" name="search" value="Search" />

</form>

 

<?

{

echo "<b>Searched For:</b> " .$find;

}

 

if ($searching =="yes")

{

echo "<h2>Results</h2><p>";

 

if ($find == "")

{

echo "<p>You forgot to enter a search term";

exit;

}

 

include("connectdb.php");

 

 

$find = strtoupper($find);

$find = strip_tags($find);

$find = trim ($find);

 

$data = mysql_query("SELECT * FROM users WHERE upper($field) LIKE'%$find%'");

 

 

while($result = mysql_fetch_array( $data ))

{

echo $result['name'];

echo " ";

echo $result['email'];

echo "<br>";

echo "<br>";

}

 

 

$anymatches=mysql_num_rows($data);

if ($anymatches == 0)

{

echo "Sorry, but we can not find an entry to match your query<br><br>";

}

 

}

?>

Link to comment
https://forums.phpfreaks.com/topic/72129-search-result-to-link/#findComment-363618
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.