基本的に、マルチパートフォームのコントローラーに、投稿データをプレビューや編集などの他の機能に提供する単一の機能を持たせたいと考えています。
機能は以下です。
function get_post_data()
{
$post_data_array = array();
// declaration of all form field names
$variable_array = array('form_field_1', 'form_field_2', ... 'form_field_n');
for ($i = 0; $i < count($variable_array); $i++) {
$variable_value = $this->input->post($variable_array[$i]);
// turn them into an easy-to-use array
$post_data_array[$variable_array[$i]] = $variable_value;
}
return $post_data_array;
}
そのため、関数は次のようにアクセスします。
function show_preview_form()
{
$this->load->view('preview_form_view', $this->get_post_data() );
}
function send_to_database()
{
$data_array = $this->get_post_data();
$this->Model->insert_to_database($data_array['form_field_1'], ...);
}
現在、動作しません。Firebug はステータスを返し500 Internal Status Error
ます。これを解決する方法を知っていますか?
get_post_data
longを必要とするすべての関数でlong を繰り返したくありません。