連絡先をフィールドに入力して送信できるようにしたいのですが、最終的にはデータベースに送信されますが、かなり長い間試していて、何が問題なのかわからない場合は、戻る方法を教えてください。データベースにあるときに「SENT」と言うエコー。同じページにリダイレクトする場合は、可能であれば、そのSENTを人々に表示するために更新する必要はありません。
これは私のコントローラーです
$this->config->db_config_fetch();
$this->load->model('skills_model');
//Get Form Data
$this->input->post('submitsms') ;
//GEt phone number from field
$type = $this->input->post('phonenumber');
//Call model
$this->skills_model->addsms($type);
}
これは私のView@ホームページです
<form method="post" action="<?php echo site_url(''); ?>" name="form" enctype="multipart/form-data">
<label>SMS Subscription</label>
<input type="text" name="phonenumber" placeholder="Phone Number here">
<button class="btn btn-info" name="submitsms" type="submit">Subscribe</button>
</form>
これは私のモデルです
function addsms($type){
$this->db->set('number', $type);
$this->db->insert('subscribers');
}
私も次のことを試しました
function addsms($type){
$sql = "INSERT INTO 'subscribers' ('number') VALUES ($type)";
$this->db->query($sql);
echo $this->db->affected_rows();
}
あなたのアドバイスは大いに役立つでしょう!ありがとう!