mouse0270 Posted February 5, 2009 Share Posted February 5, 2009 Alright I have worked with php for over 3 years and mysql for almost 2, so I am decent at it. I have never used forums for help so sorry if you don't get what I am having problems with. <?php include('header.php'); if(!$databaseid){ $databaseid = "buildings" ; } print "<br><table bgcolor='$color_body' width='60%' border='1' align='center' bordercolor='$color_border'> <tr> <form method='post' name='frm' action='search.php?action=list'> <td colspan='4' bgcolor='$color_head'> <center><b><font color='$color_head_font'>Remove A Building</font></b></center> </td> </tr> <tr> <td width='50%'> Database: </td> <td colspan='3'> <select name='databaseid' onchange=\"reload(this.form,'09z1')\">"; $result = mysql_query("show tables from ipsecurity"); while ($row = mysql_fetch_row($result)) { if ($row[0] == $databaseid){ print "<option selected value='$row[0]'>$row[0]</option><br>"; }else{ print "<option value='$row[0]'>$row[0]</option><br>"; } }print "</select> </td> </tr> <tr> <td width='50%'> Order by: </td> <td colspan='3'> <table> <tr> <td> <select name='orderby'>"; $result = mysql_query("SELECT * FROM $databaseid"); for ($i=0; $i<=mysql_num_fields($result) - 1; $i++){ $res = mysql_query("select * from $databaseid"); $var = mysql_field_name($res, $i); print "<option value='$var'>$var</option><br>"; }print "</select> </td> <td > <select name='direction'> <option value='asc'>asc</option><br> <option value='desc'>desc</option><br> </select> </td> </tr> </table> </td> </tr> <tr> <td width='50%'> Where: </td> <td> <table> <tr> <td> <select name='where'>"; $result = mysql_query("SELECT * FROM $databaseid"); for ($i=0; $i<=mysql_num_fields($result) - 1; $i++){ $res = mysql_query("select * from $databaseid"); $var = mysql_field_name($res, $i); print "<option value='$var'>$var</option>="; }print "</select><br> </td> <td> = </td> <td> <input type='text' name='whereequals'> </td> </tr> </table> </td> </tr> <tr> <td colspan='3'> <table width='100%'> <tr> <td valign='top' align='left'>"; $result = mysql_query("SELECT * FROM $databaseid"); for ($i=0; $i<=mysql_num_fields($result) - 1; $i++){ $res = mysql_query("select * from $databaseid"); $var = mysql_field_name($res, $i); print "<input type='checkbox' name='check$i' value='close'>$var<br>"; $count = $count + 1 ; if ($count == 9){ print "</td><td valign='top' align='left'>"; $count = 0 ; } }print " </td> </tr> </table> </td> </tr> <tr> <td colspan='4' align='center'> <input type='submit' value='Create List'> </td> </tr> </form> </table>"; if ($action == "list"){ print "<br><table bgcolor='$color_body' width='90%' border='1' align='center' bordercolor='$color_border'> <tr> <td colspan='100' bgcolor='$color_head'> <center><b><font color='$color_head_font'>DVS: Digital Video Surveillance</font></b></center> </td> </tr> <tr>"; $result = mysql_query("SELECT * FROM $databaseid"); for ($i=0; $i<=mysql_num_fields($result) - 1; $i++){ $var = mysql_field_name($result, $i); print "<td bgcolor='$color_head'><b>$var</b></td>"; }print " </tr>"; if (!$whereequals){ $result = mysql_query("select * from $databaseid order by $orderby $direction"); }else{ $result = mysql_query("select * from $databaseid where $where='$whereequals' order by $orderby $direction"); } while ($row2 = mysql_fetch_row($result)) { print "<tr>"; for ($i=0; $i<=(mysql_num_fields($result) - 1); $i++){ $var = mysql_field_name($result, $i); if ($close == $var){ }else{ if (!$row2[$i]){ print "<td> </td>"; }else{ print "<td>$row2[$i]</td>"; } } } print "</tr>"; }print " </tr> <tr> <td colspan='100' align='center'> <a href='searchprint.php?databaseid=$databaseid&orderby=$orderby&direction=$direction&where=$where&whereequals=$whereequals&closea=$closea'>Print View</a> </td> </tr> </table>"; } include('footer.php'); ?> everything works fine, code and everything generates depending on the database you have loaded from... I need a way to tell what check boxes are not checked, so they will not be added to the the table with you click "create list" if you know of a way, could you please share it with me? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.