いくつかの選択ドロップダウンの基本価格で複数のテーブルを設定しています。ユーザーが希望する価格を選択した後、これらすべてを 1 つのテーブルに結合したいと考えています。私が抱えている問題は、各テーブルの数値フィールド (部屋) を使用して、選択できるドロップダウンの数を設定していることです。
ドロップダウンに入力しているテーブル
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
選択ドロップダウンは次のとおりです。
<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();
}
次に、すべてのデータを収集する別のテーブルに保存します。
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
ドロップダウンの値に基づいて、services 列と price 列を入力する必要があります。値自体がサービス列に入る代わりに