約 50 個の入力チェック ボックスがあるページがあります。
name="form[]"
すべてのチェック ボックスをループできるようにするには、php スクリプトが必要です。また、どのチェック ボックスをチェックして送信するかを変数に入れる必要があるため、指定された場所にどのフォームを格納するかを指定する必要があります。
これは私のループです:
if ($this->input->post('action') == 'additional') { // Checks if radio button was checked
foreach ($this->input->post('form') as $forms) { // If above ^^^ is true loop through form[]
$givenforms = ', '.$forms.''; // What ever form[] is in the array assign them to the givenforms variable
}
$comments = 'This student was given'.$givenforms.''; // The comment I want to store in the database
}
これは機能しますが、1 つのフォーム (チェック ボックス) に対してのみ機能します。何らかの理由で、クライアントが生徒に 50 のフォームすべてを渡す必要がある場合、 $comment = 'This Student was given .......................... ………………(全50形態)」
リンクやヒントをいただければ幸いです。