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>
and controller part is
<?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.?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…