0

現在、ラジオボタンのある最初のページがあります。2 番目のページには、ラジオ ボタンごとに異なるテーブルを表示したいと考えています。

私の見解:

    <?php echo form_open('employee','class="form-inline"'); ?>
    <h3>Select User</h3>

        <?php echo form_dropdown('user-name', $name_list2);?>

    <h3>Select A Shift For Person 2</h3>
        <input type="radio" name="shift-type2" value="5" class="btn" data-toggle="button" <?php echo set_radio('shift-type2', '5'); ?> >Opening Cook</input><br>
            <input type="radio" name="shift-type2" value="6" class="btn" data-toggle="button" <?php echo set_radio('shift-type2', '6'); ?> >Opening Order-Taker</input><br>
            <input type="radio" name="shift-type2" value="7" class="btn" data-toggle="button" <?php echo set_radio('shift-type2', '7'); ?> >Closer</input><br>
            <input type="radio" name="shift-type2" value="8" class="btn" data-toggle="button" <?php echo set_radio('shift-type2', '8'); ?> >Saturday Cook</input><br>
            <input type="radio" name="shift-type2" value="9" class="btn" data-toggle="button" <?php echo set_radio('shift-type2', '9'); ?> >Saturday Order-Taker</input><br>



</form>

</div>

コントローラーに何を付ければよいかわかりません。値を取得し、if ステートメントを使用して各テーブルを表示するものだと思います。「If value equals 2, then display table B.」のようになります。

誰でもこれを行う方法を知っていますか?

4

2 に答える 2

0

あなたのモデルで

 function get()
 {
     $value=$_POST['shift-type2']; //get posted data from radio button

     switch($value)
     {
      case '5':
       $table_name="table_name5"; 
      break; 

      case '6':
       $table_name="table_name6"; 
      break; 

     case '7':
      $table_name="table_name7"; 
     break;     
   }

    $query=$this->db->get($table_name);
   return $query->result_array();
  }
于 2013-04-21T12:01:17.580 に答える