php - Codeigniter project showing 404 error or blank page -
my project in codeigniter not running. not able problem facing. have set database correctly. in routes, have set path controller.
controller - groups_controller
<?php if ( ! defined('basepath')) exit('no direct script access allowed'); class groups_controller extends ci_controller { function index() { $this->load->view('groups'); } public function group() { $this->load->model('groups_model'); if(isset($_post['addgroup'])) { $userid= '2'; $groupname= $this->input->post('group'); $data=array( 'userid'=>$userid, 'groupname'=>$groupname ); $this->groups_model->insert_groups($data); //var_dump($this->db->last_query()); } } } ?>
model - groups_model.php
function insert_groups($dbdata) { $this->db->insert('groups', $dbdata); $this->db->last_query(); }
view - groups.php
<!doctype html> <!-- change license header, choose license headers in project properties. change template file, choose tools | templates , open template in editor. --> <html> <head> <title>content</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- bootstrap --> <link href="<?php echo base_url(); ?>stylesheets/bootstrap.min.css" rel="stylesheet" type="text/css"> <link href="<?php echo base_url(); ?>stylesheets/bootstrap.css" rel="stylesheet" type="text/css"> <link href="<?php echo base_url(); ?>stylesheets/bootstrap-theme.min.css" rel="stylesheet" type="text/css"> <link href="<?php echo base_url(); ?>stylesheets/bootstrap-theme.css" rel="stylesheet" type="text/css"> <!-- html5 shim , respond.js ie8 support of html5 elements , media queries --> <!-- warning: respond.js doesn't work if view page via file:// --> <!--[if lt ie 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> <![endif]--> <script language="javascript"> // var person; // var element; // // function add() { // var e1 = document.getelementbyid('group').value; // var e2 = document.getelementbyid('select'); // var o = document.createelement('option'); // o.value = "group_body.html"; // o.text = e1; // e2.options.add(o); // // } // function goto() { // var index = document.getelementbyid('select').selectedindex; // if (index.value != "select") { // location = index.value; // } // } // function add() // { // //create input type dynamically. // element = document.createelement("button"); // element.classname='btn btn-default'; // var person = document.getelementbyid('group').value; // var t = document.createtextnode(person); // element.appendchild(t); // element.id=person; // //assign different attributes element. //// element.type = type; //// element.value = type; // really? want default value type string? //// element.name = type; // , name too? // // element.onclick = function() { // note function // //alert(element.id); //// $(document).ready(function(){ //// $("#element").click(function(){ // $('body').load('group_body.html'); //// }); //// }); // }; // // var foo = document.getelementbyid("foobar"); // //append element in page (in span). // foo.appendchild(element); //// var d = document.getelementbyid('foobar'); //// d.appendchild(i); // } // // function copy() // { // var n1 = document.getelementbyid('addkeyword'); // var n2 = document.getelementbyid('getkeyword'); // n2.innertext = n1.value; // } </script> </head> <body> <form method="post" name="form1"> <div class="btn-group" id="foobar"> <!-- <button type="button" class="btn btn-default">marketing</button> <button type="button" class="btn btn-default">internet</button> <button type="button" class="btn btn-default">politics</button>--> select group: <select class="form-control" id="select" onchange="javascript:location.href = this.value;"> <option selected value="select">select</option> <!-- <option>2</option> <option>3</option> <option>4</option> <option>5</option>--> </select> <button type="button" class="btn btn-default" id="btnadd" data-toggle="modal" data-target="#mymodal">add group</button> </div> <!-- modal --> <div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title" id="mymodallabel">group name</h4> </div> <div class="modal-body"> <h5>please enter group name:</h5> <input type="text" name="group" id="group" placeholder="group"> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">cancel</button> <button type="submit" name="addgroup" class="btn btn-primary" id="add" data-dismiss="modal">add</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> <div class="boxed"> <h4>group:<span class="label label-default" id="span"><script>document.getelementbyid('group').innertext = document.getelementbyid('span').innertext</script></span> <button type="submit" class="btn btn-default">edit name</button> <button type="submit" class="btn btn-default">disable</button> <button type="submit" class="btn btn-default">delete group</button></h4> <div class="row"> <div class="col-lg-6"> <div class="input-group"> <input type="text" class="form-control" placeholder="enter keyword" id="addkeyword"> <span class="input-group-btn"> <button class="btn btn-default" type="button" onclick="copy()">add</button> </span> </div><!-- /input-group --> </div><!-- /.col-lg-6 --> </div> <h4>keywords:</h4> <!-- <div class="keyword" id="getkeyword"></div>--> </div> </form> <!-- jquery (necessary bootstrap's javascript plugins) --> <script src="https://code.jquery.com/jquery.js"></script> <!-- include compiled plugins (below), or include individual files needed --> <script src="<?php echo base_url(); ?>javascripts/bootstrap.min.js"></script> <script src="<?php echo base_url(); ?>javascripts/bootstrap.js"></script> </body> </html>
Comments
Post a Comment