Cut down code but complete.
Assumes database connectivity and sessions
Tables are interest with id and interesttext as columns
medium with id and mediumdata as columns
ie table medium id = 1 mediumdata = DVD
id = 2 mediumdata = Video
table interest id = 1 interesttext = Musicals
id = 2 interesttext = Horror
so choosing DVD and Horror will list all titles which are both DVD and Horror in the page showresult.php
of course the table containing the titles has to hold the interestid and mediumid which equate to the relevant id entry in the relevant tables
PHP Code:
<body>
<?php
$interest=mysql_query('select id, interesttext from interest order by interesttext');
$medium=mysql_query('select id, mediumdata from medium');
?>
<form action="showresult.php" method="get" target="_parent">
<?php
$sessid = strip_tags (SID);
$sesssplit = preg_split ("/=/", $sessid);
$sessname = $sesssplit[0];
$sessid = $sesssplit[1];
?>
<input type="hidden" value="<?php echo $sessid ?>" name="<?php echo $sessname ?>">
<table width="80%" border="0" align="center">
<tr>
<td width="37%">
Search:<br />
</div></td>
</tr>
<tr>
<td height="48"><div align="center">By
<select name="interestid" size ="1">
<option selected value="">Interest</option>
<?php
while($int=mysql_fetch_array($interest)){
$interestid=$int['id'];
$interesttext=htmlspecialchars($int['interesttext']);
echo("<option value='$interestid'>$interesttext</option>\n");
}
?>
</select>
<br />
Or</div></td>
</tr>
<tr>
<td class="medboldtable"> <div align="center">By
<select name="mediumid" size="1">
<option selected value="">Medium</option>
<?php
while($med=mysql_fetch_array($medium)){
$mediumid=$med['id'];
$mediumdata=htmlspecialchars($med['mediumdata']);
echo("<option value='$mediumid'>$mediumdata</option>\n");
}
?>
</select>
<br />
</div></td>
</tr>
<tr>
<td height="26">
<div align="center">
<input type="submit" name="submit" value="Search" />
</div></td>
</tr>
</table>
</form>
<br /></div>
</body>
</html>
hope it helps
Bookmarks