Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.85 KB | None | 0 0
  1. public function index()
  2.     {
  3.         $this->load->view('view_frontend');
  4.        
  5.         echo "
  6.         <table class='table table-condensed table-hover table-striped table-responsive'>
  7.             <tr>
  8.                 <th class='col-xs-12 col-sm-12 col-md-7'>title</th>
  9.                 <th class='col-xs-12 col-sm-6 col-md-2'>Handling</th>
  10.             </tr>";
  11.            
  12.              $query = $this->db->get('ci_pages');
  13.              
  14.              echo "
  15.                         <br>
  16.                         <br>
  17.                         <br>
  18.                         <br>
  19.                         <br>
  20.                         <br>";
  21.  
  22. foreach ($query->result() as $row)
  23. {
  24.  
  25.  
  26.     echo"
  27.  
  28.                     <tr>
  29.                         <td class='col-xs-12 col-sm-12 col-md-7'>{$row->page_title}</td>
  30.                         <td class='col-xs-12 col-sm-6 col-md-2'>
  31.                             <a class='btn btn-info btn-xs' href=''>Rediger</a>&nbsp;
  32.                     ";
  33.                            
  34.                         echo "<button class='btn btn-danger btn-xs' data-toggle='modal' data-target='#myModal-{}'>
  35.                               Slet
  36.                         </button>";
  37. }
  38.            
  39.            
  40.  
  41.                    
  42.  
  43.  
  44.  
  45.        
  46.        
  47.        
  48.        
  49.    
  50.         echo"
  51.             <form method='post'>
  52.            
  53.                 <strong>Titel:</strong> <br />
  54.                
  55.                 <input type='text' class='form-control' placeholder='Titel' name='formCreatePageTitle' /><br />
  56.                
  57.                 <strong>Slug:</strong> <br />
  58.                
  59.                 <input type='text' class='form-control' placeholder='Slug' name='formCreatePageSlug'  /><br />
  60.                
  61.                 <input type='submit' name='formCreatPage' value='create page' class='btn btn-success'>
  62.                
  63.                
  64.             </form>";
  65.            
  66.             if($this->input->post('formCreatPage')){
  67.            
  68.                 if($this->form_validation->run()){
  69.                
  70.                
  71.                     $data = array(
  72.                            'page_title' => $this->input->post('formCreatePageTitle'),
  73.                            'page_slug' => $this->input->post('formCreatePageSlug')
  74.                            
  75.                         );
  76.                          
  77.                        
  78.                        
  79.                         if($this->db->insert('ci_pages', $data)){
  80.                        
  81.                             echo "det virkede";
  82.                        
  83.                         }
  84.                
  85.                
  86.                
  87.                
  88.                
  89.                
  90.                 }
  91.                
  92.            
  93.             }
  94.            
  95.            
  96.            
  97.        
  98.        
  99.        
  100.        
  101.        
  102.        
  103.        
  104.        
  105.        
  106.        
  107.        
  108.        
  109.        
  110.        
  111.        
  112.        
  113.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement