我如何应用codeigniter中的规则?

时间:2017-06-07 14:20:26

标签: php html codeigniter if-statement

我的项目是关于适合房子的颜色。如果他选择的是卧室类型且尺寸小,则结果是浅色。希望你们能帮忙。我是codeigniter领域的新手:)。我希望你们能在view.php,model.php和controller.php

中为我写信

这是我在控制器中的代码

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

 
class AutoSuggestion extends CI_Controller {
	
	function __construct()  {  

    parent::__construct();  
      $this->load->library('session');
      $this->load->helper('url');
      $this->load->helper('html');
      $this->load->database();
      $this->load->model('AutoSuggestion_model'); 
    
  } 

    public function some_action()
    {
		if (($Type_Name=='Room') && ($Size_Name=='Large'))
  {
    $this->load->view('A');
   }

   else if (($Type_Name=='Room') && ($Size_Name=='Medium'))
  {
    $this->load->view('B');
   }

      else if (($Type_Name=='Room') && ($Size_Name=='Small'))
  {
    $this->load->view('C');
   }

     else if (($Type_Name=='Bathroom') && ($Size_Name=='Large'))
  {
    $this->load->view('D');
   }
   
      else if (($Type_Name=='Bathroom') && ($Size_Name=='Medium'))
  {
    $this->load->view('E');
   }
   
      else if (($Type_Name=='Bathroom') && ($Size_Name=='Small'))
  {
    $this->load->view('F');
   }
   
      else if (($Type_Name=='Kitchen') && ($Size_Name=='Large'))
  {
    $this->load->view('G');
   }
   
     else if (($Type_Name=='Kitchen') && ($Size_Name=='Medium'))
  {
    $this->load->view('H');
   }
   
      else if (($Type_Name=='Kitchen') && ($Size_Name=='Small'))
  {
    $this->load->view('I');
   }	
}

这是我在view.php中的代码

<p>ᴥ Please select type of your space ᴥ</p>
<p>
	<input type="radio" name="type" />Room<br><br>
	<input type="radio" name="type" />Kitchen<br><br>
	<input type="radio" name="type" />Bathroom
</p>

<p>ᴥ Please select size of your space ᴥ</p>
<p>
	<input type="radio" name="size" />Small<br><br>
	<input type="radio" name="size" />Large<br><br>
	<input type="radio" name="size" />Medium
</p>

0 个答案:

没有答案