i am developing one website where i want to assign my orders to delivery boys so i am using multiple list boxes as given below with the code.
code of this screen is given below.
<?php
$CurrentOrders = FoodyComments::where('comment_date', '<=', new DateTime('today'))
->select('comment_ID', 'comment_post_ID', 'comment_date')
->get();
$CurrentOrdersCount = FoodyComments::where('comment_date', '<=', new DateTime('today'))
->get()->count();
foreach ($CurrentOrders as $CurrentOrders) {
?>
<tr>
<td>
{{$CurrentOrders->comment_ID}}
</td>
<td>
{{$CurrentOrders->comment_post_ID}}
</td>
<td>
{{$CurrentOrders->comment_date}}
</td>
<?php
$Count = DeliveryStaffDetails::get()->count();
$c = 1;
$current_orders_count = 1;
?>
<td><select name="$current_orders_count">
<?php while ($c != $Count + 1) { ?>
<option id ="<?php echo $c; ?>" value="<?php echo $c; ?>"><?php echo $c; ?></option>
<?php $c++;
}
?>
</select>
</td>
<?php $current_orders_count;
}
?>
Here i am giving dynamic names to so that i will get different names for each list box.
Below is my Controller code to access this list boxes.
public function postOrders()
{
$CurrentOrdersCount = FoodyComments::where('comment_date', '<=', new DateTime('today'))->get()->count();
$x=1;
while($x!=$CurrentOrdersCount+1) {
$mylist = $_POST[$x];
echo $mylist;
}
}
But it is not working. What is wrong over here?