I have multiple tables set up with base prices for a number of select drop-downs. I am wanting to combine all those into one table after the user selects the prices they want. The problem I am having is I am using a number field (room) of each table to populate the number of drop-downs they can select.
Table that's populating the drop-down
id room area pr_clean pr_protectant pr_sanitizer pr_deodorizer
1 1 Area 8.95 19.95 17.95 7.5
2 2 Areas 17.9 39.9 35.9 15
3 3 Areas 26.85 59.85 53.85 22.5
4 4 Areas 35.8 79.8 71.8 30
5 5 Areas 39.95 99.75 89.75 37.5
6 6 Areas 53.7 119.7 107.7 45
7 Whole House Areas 69.95 139.65 125.65 52.5
and the select drop-down is:
<select name="rooms" id="Areas">
<option value="" selected="selected">0</option>
@foreach ($room as $rooms)
<option data-price="{{ $rooms->pr_clean }}" value='{{ $rooms->room }}'>{{ $rooms->room }}</option>
@endforeach
</select>
the data is saving like this via my php controller:
$input = [
Input::get('rooms')
];
// echo '<pre>';
// var_dump($input); die;
foreach($input as $services)
{
$service = new Service();
$service->userID = $user->id;
$service->services = $services;
$service->save();
}
Which is then saving into another table that collects all the data.
id userID services price created_at updated_at
156 1 6 NULL 2013-09-08 01:14:26 2013-09-08 01:14:26
157 1 3 NULL 2013-09-08 01:14:26 2013-09-08 01:14:26
I need the services column and the price column to populate based on that value in the drop-down. Instead of the value itself going into the services column