Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.