带有所选选项ID的网址

时间:2017-08-14 14:17:13

标签: php codeigniter base-url

美好的一天!我有一个问题 - 当我选择要在我的网址中反映的活动类型时,我需要我的activityID吗?类似于 localhost / codeigniter / index.php / edit / show_activity_id / 8 但现在我只是 localhost / codeigniter / index.php / edit / show_activity_id / 我怎么能纠正它?

public function get_activities()  {  
      //set selected activity id from POST  
      echo $projectID = $this->input->post('id',TRUE);  
      $activityData['activities']=$this->editmodel->get_activities($projectID);  
      $output = null;  
      foreach ($activityData['activities'] as $row){   
      $output .= "<option value='base_url().index.php/edit/show_activity_id/'".$row->activityID."'>".$row->activityName."</option>"; 

      }  
      echo $output;    
   }

1 个答案:

答案 0 :(得分:0)

有一个额外的单引号。请删除它

activity_id /&#39;&#34;。$ row-应为activity_id /&#34;。$ row -

public function get_activities()  {  
      //set selected activity id from POST  
      echo $projectID = $this->input->post('id',TRUE);  
      $activityData['activities']=$this->editmodel->get_activities($projectID);  
      $output = null;  
      foreach ($activityData['activities'] as $row){   
      $output .= "<option value='".base_url().".index.php/edit/show_activity_id/".$row->activityID."'>".$row->activityName."</option>"; 

      }  
      echo $output;    
   }