NameSilo

Search Page

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch
OK This tutorial will show you how to make a search page.

Firstly we make a form. I am going to use this:

PHP:
<form method="post" action="searchpage.php">
<p>Please enter keyword.</p>
<p>
<input name="word" type="text" size=25 maxlength=25>
</p>
<p>
<input type="Submit" name="Submit" value="Submit">
</p>
</form>
This is the form where we will enter the keywords. Now the next step is to make the searchpage.php.

It will look like this

PHP:
<?php
// connect to db
$db = mysql_connect("localhostt", "username", "password");
mysql_select_db("dbname",$db);

//check something is sent
if ($_POST['word']) {
$word= $_POST["word"];
// search query
$result = mysql_query("SELECT * FROM `table` WHERE `field` LIKE '%$word%'");
$postword = $_POST['word'];
echo "Search Results for: <strong> $postword </strong> <br />";
echo"<p> </p>";
echo"<p> </p>";
echo"<p> </p>";
echo"<p> </p>";
//get results
while($get=mysql_fetch_array($result))
{


$date = $get['date'];
$name = $get['name'];
$title= $get['title'];

//show results
echo("<strong>$title</strong> was added on <strong>$date</strong> by <strong>$name</strong>");

echo"<p></p>";
echo"<p></p>";
}
// if nothing is sent
}else {
die ("No search word specified");
}

?>
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back