У меня есть страница PHP, которая выводит результаты запроса MySQL.каждая выведенная строка имеет флажок.Пользователь проверит нужные строки и нажмет кнопку просмотра деталей.Затем я хочу отобразить результаты запроса MySQL, который зависит от выбора пользователей.
SELECT * FROM table WHERE id = 'selected Checkbox's'
Моя страница PHP выглядит следующим образом:
<?php
mysql_connect("localhost", "hulamin_hulamin", "Hulamin2011")or die("cannot connect");
mysql_select_db("hulamin_loc")or die("cannot select DB");
$sql="select loadid as `Order Number`, LOCStatus as `Load Status`,count(loadid) as `Number of Cases`,sum(`Gross Mass`) as `Total Weight`, customer as Customer, transporttypename as `Transport Type` from despgoods_alldetails where loadid > 0 group by loadid";
$result=mysql_query($sql);
$count=mysql_num_rows($result); ?> <table border=0>
<tr>
<td>
<form name="form1" method="post">
<table border=1
<tr>
<th> </th>
<th width=150>Order number</th>
<th width=150>Status</th>
<th width=150>Number of Cases</th>
<th width=130>Total Weight</th>
<th width=300>Customer</th>
<th width=150>Transport Type</th>
</tr> <?php
while($rows=mysql_fetch_array($result)){ ?>
<tr>
<td><input type="checkbox" name=check[] value="<?php echo $rows['Order Number']; ?>"></td>
<td><?php echo $rows['Order Number']; ?></td>
<td><?php echo $rows['Load Status']; ?></td>
<td><?php echo $rows['Number of Cases']; ?></td>
<td><?php echo $rows['Total Weight']; ?></td>
<td><?php echo $rows['Customer']; ?></td>
<td><?php echo $rows['Transport Type']; ?></td>
</tr>
<?php
} ?>
<tr>
<td colspan=7><input name="ViewDetails" type="submit" id="ViewDetails" value="ViewDetails"></td>
</tr>
<?php
$check=$_POST['check'];
if($_REQUEST['ViewDetails']=='ViewDetails'){
}
mysql_close(); ?> </table> </form> </td> </tr> </table>
После нажатия кнопки отправки яхотите, чтобы запрос выполнялся и выводил результаты
select * from desp_goods where loadid=$checkboxes
Любая помощь будет принята.
Спасибо, Райан