Folks,
I am hoping for some help with my PHP installation under windows xp. It was installed using the xampp script and seemed to go very well until i tried running the following html and php.
When the php code (searchform.php) is called windows wants to download the file not execute it. Any help is appreciated, I'm new at this and it is slow going.
Thanks,
Peter
There are two code files:
File 1 - searchform.htm
<html>
<body>
<form action=searchform.php method=GET>
Search for:
<p>
First Name: <input type=text name=fname size=15 maxlength=15>
<p>
Last Name: <input type=text name=lname size=15 maxlength=15>
<p>
<input type=submit>
</form>
</body>
</html>
File 2 - searchform.php
# ---- Begin searchform.php
<?
mysql_connect (<MySQLserver>, <username>, <password>);
mysql_select_db (<dbname>);
if ($fname == "")
{$fname = '%';}
if ($lname == "")
{$lname = '%';}
$result = mysql_query ("SELECT * FROM <tablename>
WHERE fname LIKE '$fname%'
AND lname LIKE '$lname%'
");
if ($row = mysql_fetch_array($result)) {
do {
print $row["fname"];
print (" ");
print $row["lname"];
print("<p>");
} while($row = mysql_fetch_array($result));
} else {print "Sorry, no records were found!";
}
?>
# ---- End searchform.php