ChrisRChamberlain
Programmer
Hi all
Following thread434-1351433 decided to create a site search engine in a mix of VFP and PHP.
The following barebones PHP script correctly queries the database and retrieve the page links etc.
What am uncertain of is how to 'send' the data from the HTML form to assign to the variable $searchstring currently hard coded in the example.
Any quidance would be appreciated.
TIA
PDFcommander.com
motrac.co.uk
Following thread434-1351433 decided to create a site search engine in a mix of VFP and PHP.
The following barebones PHP script correctly queries the database and retrieve the page links etc.
What am uncertain of is how to 'send' the data from the HTML form to assign to the variable $searchstring currently hard coded in the example.
Code:
<html>
<head>
<title>Search results</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<?php
//connect to the database
$connectionstring = odbc_connect("vfptable", "", "");
// searchstring passed from form
$searchstring = "[Display]";
// Get number of records
$countQuery = "SELECT COUNT(*) FROM pagedata ".
"where $searchstring $ innertext";
$result = odbc_exec($connectionstring, $countQuery);
odbc_fetch_row($result,0);
$numRecords = odbc_result($result, 1);
// Execute search query
$Query = "SELECT * FROM pagedata ".
"where $searchstring $ innertext";
$queryexe = odbc_do($connectionstring, $Query);
// Query database
print ("Total instances found is ".$numRecords);
print ("<br>");
print ("<br>");
$instances=0;
while(odbc_fetch_row($queryexe))
{
$filename = odbc_result($queryexe, 1);
$title = odbc_result($queryexe, 2);
$dispstring = odbc_result($queryexe, 4);
print ("$instances"+1);
print (".");
print (" ");
print ("<a href='$filename'>$title</a>");
print ("<br>");
print ("$dispstring");
print ("<br>");
print ("<br>");
$instances=$instances+1;
}
//disconnect from database
odbc_close($connectionstring);
?>
</body>
</html>
TIA
FAQ184-2483 - answering getting answered.
Chris PDFcommander.com
motrac.co.uk