不能在codeigniter中获得post表单提交值

编程入门 行业动态 更新时间:2024-10-25 03:25:10
本文介绍了不能在codeigniter中获得post表单提交值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我尝试了一个简单的表单提交但是我不能得到控制器上的形式值使用 $ this-> input-> post 以及 $ _ POST [] 方法。我的观看部分是

I tried a simple form submit But I am not able to get the form values on controller using $this->input->post as well as $_POST[] methods. My view part is

<html> <head> <title> Feedback page</title> </head> <body> <?php echo form_open('feedback/save'); ?> <p> <label>name: </label> <?php echo form_input('name'); ?> </p> <p> <label>Email: </label> <?php echo form_input('email'); ?> </p> <p> <label>Feedback: </label> <?php echo form_textarea('feedback'); ?> </p> <p> <?php echo form_submit('submit','Submit'); ?> </p> <?php echo form_close(); ?> </body> </html>

且控制器部分为

<?php class Feedback extends CI_Controller { function __construct() { parent::__construct(); $this->load->model("MFeedback"); } function index() { $this->load->view('home/feedback_view.php'); //print "loaded"; } function save() { print "called"; print_r($this->input); $name = $this->input->post('uname'); $email = $this->input->post('email'); $feedback = $this->input->post('feedback'); print $name . $email . $feedback; $this->index(); } } ?>

我不知道这里出了什么问题,还是有任何配置设置我需要查看。

I am not sure what went wrong here or is there any config settings I need to look in to it.?

推荐答案

我发现了问题。它实际上是用重写规则。请确保您已重写规则,例如

I have found out the problem. It is actually with the rewrite rule. Make sure you have rewrite rule like

RewriteEngine On RewriteRule ^(application) - [F,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php/$0 [PT,L]

在codeigniter的根文件夹。

on root folder of codeigniter.

更多推荐

不能在codeigniter中获得post表单提交值

本文发布于:2023-10-09 18:38:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1476467.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:能在   表单   codeigniter   post

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!