Multiple checkbox function PHP & Mysql -
i'm beginner in both php & mysql , 've been working multiple checkboxes function days. @ first nothing seem to work nonetheless, has given result can't seem create table out of it
and here php page:
<?php if(isset($_request['submit'])) { $str = ' 1=1 '; if( count($_post['field']) > 0 ) { $field = implode(',',$_post['field']); $str.= ' , company_field '.$field.''; } if( count($_post['size']) > 0 ) { $size = implode(',',$_post['size']); $str.= ' , company_size '.$size.''; } $run = "select * company 1=1 , company_field '$field' , company_size '$size'"; echo $run; $result = mysql_query($run); while ($row = mysql_fetch_array($result)){ $company_name = $row[0]; $company_field = $row[1]; $company_size = $row[2]; ?> <tr align = 'center'> <th><?php echo $company_name; ?></th> <td><?php echo $company_field; ?></td> <td><?php echo $company_size; ?></td> </tr> <?php }?> <?php } ?>
but can't create table , don't know why.
to create table need <table>
tags so:
<table> <tr align = 'center'> <th><?php echo $company_name; ?></th> <td><?php echo $company_field; ?></td> <td><?php echo $company_size; ?></td> </tr> </table>
if you're making new row in "while" should put <table>
tag before loop , </table>
tag after loop
Comments
Post a Comment