Pages

Showing posts with label tutorial. Show all posts
Showing posts with label tutorial. Show all posts

Laravel run/access without php artisan

Laravel is Framework of php language,  its access through command php artisan server but when we run the project using live/domain name then..

its

http://localhost/<project_name>/public/



Codeigniter Tutorial 2: How do i get the select tag value with codeigniter?


How to get a selected option value in your controller in codeigniter Here are steps

company.php in view

<form action="" method="POST">
    <select name="company"  class="form control">
      <option value="1">Employee </option>
      <option value="2">HR</option>
      <option value="3">Student</option>
    </select>
    <input type="submit" name="submit" value="Post it">
  </form>

or Display from database field list 
 $cmp_values = $this->db->query("SELECT * from company");

<select name="company" aria-controls="example1"   class="form-control"  required>
     <option value="">Select</option>
    <?php foreach($cmp_values->result_array() as $cmpdet){?>
    <option   value="<?=$cmpdet['com_id']?>"><?=$cmpdet['com_value']?></option>
    <?php }?>

</select> 



Then in your controller:

Company.php

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Company extends CI_Controller {
 
   public function index() {
     if( $this->input->post) {
        echo $this->input->post('company');
       }
    $this->load->view('company');
   }
}

Popular Posts