【发布时间】:2018-01-22 09:59:35
【问题描述】:
美好的一天!我有一个问题 - 当我选择要反映在我的 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;
}
【问题讨论】:
-
所以你在这里写的选项值属性中缺少它?那么很可能您的 $row 没有名为
activityID的属性 ... -
检查模型中的 get_activities 方法并查看它返回的所有内容,如果缺少 ID,只需将其添加到那里。
标签: php codeigniter base-url