データベースにデータを挿入する際に問題があります。エラーは表示されませんが、データはデータベースに挿入されません。データがデータベースに挿入されていないため、エラーは表示されません。
コントローラコード
function FormData($data){
if (!empty($_POST['name'])) {
$data = array(
'name' => $this->input->post('name'),
'position' => $this->input->post('position'),
'about_me' => $this->input->post('about_me'),
'contact_me' => $this->input->post('contact_me'),
'email' => $this->input->post('email'),
'temp_addr' => $this->input->post('temp_addr'),
'perm_addr' => $this->input->post('perm_addr'),
'skill' => $this->input->post('skill'),
'photo' => $this->input->post('photo'),
);
$this->Maboutus->form_insert($data);
redirect('/admin');
}
}
モデルのコード
function form_insert($data){
$this->db->insert('aboutus',$data);
}
ビューファイル
<div class="container">
<div class="col-md-8">
<form action="#" method="POST" class="form-horizontal">
<div class="col-md-12">
<div class="form-group">
<lebel for="name" class="col-md-4" >Name :</lebel>
<input type="text" name="name" id="name" class="col-md-8" placeholder="your name " required>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-12">
<div class="form-group">
<lebel for="position" class="col-md-4" >Position :</lebel>
<input type="text" name="position" id="position" class="col-md-8" placeholder="your position " required>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-12">
<div class="form-group">
<lebel for="position" class="col-md-4" >About Me :</lebel>
<input type="text" name="about_me" id="about_me" class="col-md-8" placeholder=" your name About me " required>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-12">
<div class="form-group">
<lebel for="position" class="col-md-4" >Mobile No :</lebel>
<input type="text" name="contact_me" id="contact_me" class="col-md-8" placeholder=" your Mobile number" required>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-12">
<div class="form-group">
<lebel for="position" class="col-md-4" >Email :</lebel>
<input type="text" name="email" id="email" class="col-md-8" placeholder=" your email " required>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-12">
<div class="form-group">
<lebel for="position" class="col-md-4" >Temporary Addr :</lebel>
<input type="text" name="temp_addr" id="temp_addr" class="col-md-8" placeholder=" your Temporary Address " required>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-12">
<div class="form-group">
<lebel for="position" class="col-md-4" >Permanent Addr :</lebel>
<input type="text" name="perm_addr" id="perm_addr" class="col-md-8" placeholder=" your Permanent Address " required>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-12">
<div class="form-group">
<lebel for="position" class="col-md-4" >Skill :</lebel>
<input type="text" name="skill" id="skill" class="col-md-8" class="col-md-8" placeholder="your skill " required>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-12">
<div class="form-group">
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" class="col-md-8" name="photo" id="photo">
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<input class="col-md-8" class="btn btn-primary" type="submit" value="Submit"></br></br>
</div>
</div>
</form>
</div>
私はpHの新しいですpは、データがデータベースに挿入されていないので、何ができますか?誰かが私を助けてください。私は検索しようとしましたが、間違ったことは何も見つかりません。この問題から私を助けてください。
ターンEでそれを行うに注意してください。あなたのindex.phpファイルにerror_reporting(E_ALL);を追加して報告しています。 –
私は試しましたが、何も得られません。 –
この '$ data'は' - '' FormData($ data){'?そのURLをフォームに渡したり、そのメソッドのビューをロードしたりすることはありません。 – Tpojka