I want people to be able to request a name or title from my mysql database and have the result displayed to them..when I use the following html and php pages I get all the names in the database as opposed to the one requested..???
I have the following html form
<form action=searchform2.php method=GET>
Search For:
<p>
Title: <input type=text name=Title size=25 maxlength=25>
<p>
Last Name: <input type=text name=last_name size=25 maxlength=25>
<p>
EmailName: <input type=text name=EmailName size=25 maxlength=25>
<p>
<input type=submit>
</form>
and the following php page..
<body>
<?php
mysql_connect (localhost, root, ****);
mysql_select_db (mydb);
if ($Title == "")
{$Title = '%';}
if ($LastName == "")
{$LastName= '%';}
if ($FirstName == "")
{$FirstName = '%';}
if ($EmailName == "")
{$EmailName= '%';}
$result = mysql_query ("SELECT * FROM thetable
WHERE Title LIKE '$Title%'
AND LastName LIKE '$LastName%'
AND FirstName LIKE '$FirstName%'
AND EmailName LIKE '$EmailName'
");
if ($row = mysql_fetch_array($result)) {
do {
?>
<tr>
<td bgcolor="#999999"><?php print $row["Title"] ?><br></td>
<td bgcolor="#CCCCCC"><?php print $row["LastName"] ?><br></td>
<td bgcolor="#999999"><?php print $row["FirstName"] ?></td>
<td bgcolor="#CCCCCC"><?php print $row["EmailName"] ?></td>
</tr>
<?
print ("");
} while($row = mysql_fetch_array($result));
} else {print "Didn't Work<br><br> -Ron-!";}
?>
</table>
</body>