truck7758 Posted March 28, 2008 Share Posted March 28, 2008 Hi, i have created a page that displays a list of suppliers but what i want to be able to do is filter the results to specify individual suppliers. I currently have the following code which displays the full table: <title>View Suppliers</title> <BODY TEXT="red" LINK="yellow" BGCOLOR="black"> <a href="http://www.google.co.uk"> <img src="new_logo2.jpg" alt="logo" align="center" width="210" height="95" /> </a> <? print strftime("%A %dth %B %Y %H:%M"); ?> <h1 align="center">Suppliers<h1> <table border=\"7\"> <tr> <th>Supplier ID</th> <th>Name</th> <th>Address</th> <th>Telephone Number</th> <th>Fax Number</th> <th>Website</th> <th>Account Number</th> <th>Account Manager</th> <th>Email Address</th> <th>Account Login</th> <th>Account Password</th> <th>Other Info</th> </tr> <?php // Connecting, selecting database $mysqli = new mysqli('host','username','password'); $mysqli->select_db('orders'); // Performing SQL query $result = $mysqli->query("SELECT * FROM supplier"); while($line = $result->fetch_assoc()) { echo "\t<tr>\n"; foreach ($line as $col_value) { if (empty($col_value)) { echo "\t\t<td> </td>\n"; } else { echo "\t\t<td>$col_value</td>\n"; } } echo "\t</tr>\n"; } // Free resultset mysqli_free_result($result); // Closing connection $mysqli->close(); ?> </table> <p> <a href="index.php"> <INPUT TYPE="SUBMIT" VALUE="Home" STYLE="font-family:sans-serif; font-size:large; font-style:italic; background:red; color:black; width:6em; height:1.5em"> </a> and i also have the following which creates the drop down list of suppliers: <? $mysqli = new mysqli('localhost','root','newr00t'); $mysqli->select_db('orders'); $result = $mysqli->query("SELECT * FROM supplier"); echo "<SELECT name='supp'>\n"; while($row = $result->fetch_assoc()) { echo "<option value='{$row['suppid']}'>{$row['name']}</option>\n"; } echo "</select>\n"; $result->close(); ?> what i need now is to join the two with sum sort of 'submit' button but i dont really know how to do this. Any ideas, Thanks Link to comment https://forums.phpfreaks.com/topic/98288-filter-results/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.