![]() |
Newbie Problem in simple MVC login program..... - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Newbie Problem in simple MVC login program..... (/showthread.php?tid=57225) |
Newbie Problem in simple MVC login program..... - El Forum - 02-27-2013 [eluser]Unknown[/eluser] Hi guy's,I am new to codeigniter and I am doing simple MVC login program using CI, But not getting output,instead I am getting Server error HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request. MY Controller file studentform.php is as <?php class Studentform extends CI_Controller { public function index() { $this->load->helper("form") $this->load->library("form_validation"); $this->form_validation->set_rules("first","First Name","required"); $this->form_validation->set_rules("middle","Middle Name","required"); $this->form_validation->set_rules("last","Last Name","required"); $this->form_validation->set_rules("address","Address","required"); $this->form_validation->set_rules("class","Class","required"); $this->form_validation->set_rules("email","E-mail Address","required|valid_email"); if($this->form_validation->run()==false) { $this->load->view("studentform_view"); } else { $first=$_POST["first"]; $middle=$_POST["middle"]; $last=$_POST["last"]; $address=$_POST["address"]; $class=$_POST["class"]; $contact=$_POST["contact"]; $email=$_POST["email"]; $data=array("first_name"=>$first, "middle_name"=>$middle, "last_name"=>$last, "address"=>$address, "class"=>$class, "contact"=>$contact, "email"=>$email); $this->load->model("studentform_model"); $this->studentform_model->insert_address($data); $this->load->view("studentformsuccess_view"); } } } My View files studentform_view.php and studentformsuccess.php <html> <head> <title> Student</title> </head> <?php echo validation_errors(); echo form_open("studentform"); ?> <label for="first">First Name</label> <input type="text" name="first"><br> <!-- <label for="middle">Middle Name</label> <input type="text" name="middle"><br> --> <label for="last">Last Name</label> <input type="text" name="last"><br> <!-- <label for="address">Address</label> <input type="text" name="address"><br> <label for="class">Class</label> <input type="text" name="class"><br> --> <!-- <label for="contact">Contact No.</label> <input type="text" name="contact"><br> --> <label for="email">E-mail Address</label> <input type="text" name="email"><br> <input type="submit" name="submit" value="Submit"> </form> </html> View file 2 studentformsuccess.php is as <html> <head> <title>Student Form Successful!</title> </head> <body> <h3> Your Form was successfully submitted!</h3> <p><a > Add Another Student Details</a></p> </body> </html> MY Model File studentform_model.php is <?php class studentform_model extends CI_Model { public function insert_address($data) { $this->load->database(); $this->db->insert("studentform",$data); } } Please look at the code and suggest me where is I am wrong... Thanks in advance!!! |