クリックすると、コントローラーに引数を次のような関数に渡すリンクがあります。
/ home / inquire / 54
- 次に、フォームを含むビューをロードして、入力データを収集します。
- 次に、引数とフォームデータの両方を自分にメールで送信したいと思います
これは私のコントローラーです:
public function inquire($id) {
$this->form_validation->set_rules('inputName', 'Name', 'required');
if ($this->form_validation->run() == FALSE) {
$this->load->view('client/M_inquire.php');
} else {
$this->email->from('noreply@test.com', 'System');
$this->email->to('contactus@test.com');
$this->email->subject('New Client Registration');
$this->email->message(
"Name: " . $this->input->post('inputName') . "<br />" .
"Phone: " . $this->input->post('inputPhone') . "<br />" .
"Email: " . $this->input->post('inputEmail') . "<br />" .
"Nurse profession: " . $this->input->post('inputProfession') . "<br />" .
"Nurse ID: " . $nurseid
);
$this->email->send();
$this->load->view('client/M_inquire_success.php');
}
}
これは私の見解です:
<?php echo form_open('home/inquire'); ?>
<label>Full Name</label>
<input type="text" name= "inputName" id="inputName">
問題は、コントローラーが引数を予期しているため、フォームを開くとクラッシュすることです。渡した最初の引数を維持し、フォームデータを収集して両方を電子メールで送信する方法はありますか?
どうもありがとう。