この問題についてはおかしくなります。このフォームを送信できません。ページが更新されるだけです。
私はそれを私のサイトの他のフォームとまったく同じようにコーディングしましたが、それはうまく機能します。なぜ提出されないのか理解できません!
コントローラは次のとおりです。
public function edit($id)
{
// check for login, if logged in
if($this->session->userdata('logged_in') == "1")
{
// Check usertype, if not correct, redirect
if($this->session->userdata('usertype') == "0" || $this->session->userdata('usertype') == "1" || $this->session->userdata('usertype') == "2")
{
// if no photos are selected, redirect and show notification
$this->session->set_flashdata('notification_fail', '<p style="text-align:center; color:#fbfbfb;">You do not have permission to access that page!<p>');
redirect('/');
}
else
{
// get the copy details
$data['copy_details'] = $this->quickcopy_model->get_copy_details($id);
if ($_POST)
{
// get data from the submitted form
$title = $this->input->post('title', TRUE);
$copy = $this->input->post('copy', TRUE);
// update the row in the db
$this->quickcopy_model->edit_go($id, $title, $copy);
// redirect and show notification
$this->session->set_flashdata('notification', '<p style="text-align:center; color:#fbfbfb;">That copy was updated!<p>');
redirect('quick-copy');
die;
}
// load views
$this->load->view('templates/header', $data);
$this->load->view('quickcopy/quickcopy_edit', $data);
$this->load->view('templates/footer', $data);
}
}
else
{
// redirect to signin page if not logged in
redirect('signin');
}
}
そして、モデルから呼び出される関数:
public function edit_go($id, $title, $copy)
{
$data = array(
'title' => $title,
'copy' => $copy
);
$this->db->where('id', $id);
return $this->db->update('quickcopy', $data);
}
そして最後にビュー:
<? echo form_open('quickcopy/edit/'.$copy_details->id); ?>
<p>Title/tagline:</p>
<input type="text" class="Form_Input" id="title" name="title" value="<? echo $copy_details->title; ?>" />
<p style="margin-top: 10px;">Copy:</p>
<textarea id="copy" name="copy" class="Form_Textarea" style="width: 970px"><? echo $copy_details->title; ?></textarea>
<button type="submit" class="Form_SubmitButton"><p style="color: #f7f7f7; text-align: center;">Save changes</p></button>
</form>
これについてフォーム検証を行っていないことに気付きましたが、フォーム検証を使用した別のフォームがあり、それも機能しません。
これについて2日間完全に混乱しているので、なぜ送信されないのかわかりません。コードはすべて私には問題ないように見えますが、フォームが送信されない他の理由は何でしょうか?SSLをインストールしたばかりですが、正常に機能する他のフォームがあるため、SSLではないと想定しています。
どんな助けでも大歓迎です:)