ドロップダウンフィールドを持つ登録フォームを作成しましたが、データベースにリンクして選択項目を登録することができません。私はフォーム検証を有効にしていますが、値が選択されていないと言っています。フォームドロップダウンがCodeigniterに登録されていません
他の入力は、ユーザーが入力したとおりに機能します。ただし、このドロップダウンの値は値として登録されません。いかなる援助も感謝します。
ありがとうございます!
ビュー
<div class = "form-group">
<?php echo form_label('Mobile Carrier'); ?><br/><!--Form Label-->
<?php
$data = array(
'None' => 'None',
'att' => 'AT&T',
'verizon' => 'Verizon',
'sprint' => 'Sprint',
'tmobile' => 'T-Mobile'
);
?>
<?php echo form_dropdown('Mobile Carrier', $data, 'None'); ?>
コントローラ
public function register(){
$this->form_validation->set_rules('mobile_carrier', 'Mobile Carrier', 'required'); }
ユーザーモデル
public function create_user(){
$data = array(
'first_name' => $this->input->post('first_name'),
'last_name' => $this->input->post('last_name'),
'email' => $this->input->post('email'),
'phone_number' => $this->input->post('phone_number'),
'mobile_carrier' => $this->input->post('mobile_carrier'),
'username' => $this->input->post('username'),
'password' => $encrypted_pass
);
$insert_data = $this->db->insert('users', $data);
return $insert_data;
}
にスクロール!私はそれをやったことが分からない。あまりにも長い@ _ @ありがとうございました! – ShooterMcGavin