dongzhi7641 2016-08-24 07:04
浏览 29

从控制器向视图发送值

How can I achieve this, I am sending data from view to controller then back to another form in view, then also I need to pick data on table in database and sending it to controller then to view,

Here is my controller:

 public function new_orders(){ 
   //data from views then to another form
   in views  $category_id=$this->uri->segment(3);
   $data['registration_number'] = $category_id;
   //data from model to view 
   $this->data["product_id"]=$this->select->get_product_id();
   $this->load->view("product_add", $data);
 }

My model:

function get_product_id(){
  $this->db->select_max('product_id');
  $this->db->from('products');
  $query = $this->db->get();
  return $query->result_array();
}

I want a form in view to display registration_number at the same time product_id.

In view registration_number is displayed but not product_id, it seems to be undefined variable. Help me please to solve it

  • 写回答

2条回答 默认 最新

  • dsgdfh302506 2016-08-24 07:11
    关注

    update your code with below, use $this->data instead of $data

    $this->load->view("product_add", $this->data);
    
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度