Searching the Products
We want to build in some aspects of being able to search the site.
We will focus on searching products by looking for something in their
name. Thus, if someone is looking for something native or a DVD or
a t-shirt or edible undies or anything like these, we want the shopper
to be able to list out certain products with links.
So this page will need a number of characteristics
Now you need to copy the following code and name it search.php. After the code we give a brief discussion of its overall structure and content.
<!-- search.php - processes and displays the results of a search -->
<head><title>The Firefox Search Page</title></head>
<form method="post" action="search.php">
<table align=center border=0 width=600 cellpadding=7>
<td align="right" width="250"><font size="4" color="#c0c0c0">Search:</font>
<td align="left"><input type="text" width="20" style="font size: 14pt" name="txt_search" value="<?php echo $txt_search; ?>">
<td align="center" colspan="2"><input type="submit" value="Search" style="font size: 14pt">
<table align = "center" border = 0 width = 600 cellpadding=5>
if ($txt_search != "")
|As usual you also want to make sure
you distinguish our PHP scriptlets from the HTML. We move back
and forth quite a bit.
More will be said about this after you upload this and get it to work. Passing extra arguments in the URL is making use of a GET approach rather than the POST we have used so far to pass information to a subsequent PHP.
We have no longer colored certain tricks since you should be getting more used to them. Though, remember it can still be useful to reorganize the code after you copy it to assist your understanding.