I am trying to make a search form (which will be best to be with drop down menu) with values from column CUST_BULSTAT
and to fetch a single row data that will be printed into a text template document.
On this stage I am connecting to database and fetch some data. But this should be made by search form
My code is as follows
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<form action="" method="post">
<input type="text" name="search" /><br />
<input type="submit" value="Submit" />
</form>
<?php
$host = 'localhost:C:\Program Files (x86)\Firebird\Firebird_2_5\bin\Service.gdb';
$username = 'SYSDBA';
$password = 'masterkey';
$dbh = ibase_connect("localhost:C:\Program Files (x86)\Firebird\Firebird_2_5\bin\Service.gdb","SYSDBA", "masterkey", "UTF-8") or die('die message');
$search = s($_REQUEST['search']);
$q = ibase_query($dbh, "select * from CUSTOMERS WHERE CUST_BULSTAT LIKE '%".$search."%'");
while ($row = ibase_fetch_object($q)) {
echo $row->CUST_BULSTAT, "<br>";
echo $row->CUST_MANAGERNAME, "<br>";
echo $row->CUST_TOWN, "<br>";
echo $row->CUST_STREET, "<br>";
}
ibase_free_result($q);
ibase_close($dbh);
?>
</body>
</html>
With best regards Valentin