I have a form with several check boxes. I am trying to retreive the 'model' that has the checked features form the database 'cashreg' . I am getting the following error messages
"Fatal error: Call to a member function quote() on a non-object in c:\wamp\www\compstore\handle_cashreg3.php on line 14"
Form is as follows:
<form action="../handle_cashreg3.php" method="get">
<p>
<input name="item[]" type="checkbox" id="network" value="yes">
Networkable
<input name="item[]" type="checkbox" id="touchscreen" value="yes">
Touch Screen
<input name="item[]" type="checkbox" id="printrec" value="Yes">
Print Receipts
<input name="item[]" type="checkbox" id="scanner" value="yes">
Scanner
<p> </p>
</body>
</html><?php
?>
<p>
<input type="hidden" name="submitted" value="yes" />
<input type="submit" value="submit" />
and the form processor is:
<?php require_once('Connections/dbcompstore.php');
<?PHP
// get multiple records
foreach ($_GET['item'] as $s) {
$item[] = strtr($dbh->quote($s),array ('_' =>'\_','%' => '\%'));
}
$parts = join(',', $item);
// select the model of till that has the features clicked yes
$dbh->query("SELECT * FROM cashreg WHERE model IN ($parts)");
//print list of models
echo '<table align="center"
cellspacing="2" cellpadding="2">
<tr><td align="left"><b>Model</b></td></tr>
';
while ($row=mysql_fetch_array($dbh))
echo "<tr><td align=\"left\">" .stripslashes($row[0]). "</td><td align=\"left\">$row[1]</td></tr>\n";
echo '</table>';
echo '<p> there are no records</p>';
mysql_close();
?>
Help much appreciated
Thanks
Charles