いくつかの行を表示するループを持つフォームを作成しました。フォームヘルパーを使用して、各行を選択します。作成するIDはすべて同じですが、IDにカウンターや定義情報を追加する方法はありますか?
私は$this->Form->input('city_id')
自分の都市モデルから選択した都市を出力するために使用しています。すべてのIDはModelCityId
です。ModelCityId1 、、、などのようなものを取得したいのですが、ModelCityId2
これModelCityId3
は可能ですか?または、オプションをループで表示するためのより良い方法はありますか?
あなたが持っているかもしれないどんな提案にも感謝します。
これがコードの関連部分です。
while ($current_date != $departure_date) {
$current_date = date("d-M-y", strtotime($current_date . " +1 day"));
$output .= '<tr>';
$output .= '<td>'.$current_date.'</td>';
// irrelevant other columns
$output .= '<td>'.$this->Form->input('city_id', array('label' => '', 'empty' => true)).'</td>';
$output .= '</tr>';
}