[英]post value not getting on codeigniter
I want to get post value in Controller so that I had done my code like this. 我想在Controller中获取帖子值,这样我就可以完成我的代码了。 The Controller looks like this 控制器看起来像这样
public function save_expense($id = NULL)
{
$data['amount'] = $this->input->post('amount',TRUE);
var_dump($data['amount'] );
print_r($data['amount']);
}
My View file looks like this 我的查看文件如下所示
<form class="col s12" enctype="multipart/form-data" action="<?php echo base_url();?>admin/transactions/save_expense/<?php if (!empty($expense_info)) { echo $expense_info->transactions_id;}?>" method="post">
<div class="row">
<div class="input-field col s12">
<input placeholder="Amount" type="text" required name="amount" id="amount" value="<?php if (!empty($expense_info)) {echo $expense_info->amount;}?>">
<label for="amount"><?= lang('amount') ?></label>
</div>
</div>
<div class="btn-area">
<button class="btn waves-effect waves-light " type="submit" name="action">Update </button>
</div>
</form>
My .htaccess file looks like this 我的.htaccess文件如下所示
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(application) - [F,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
</IfModule>
I'm not getting any value that is passing to the controller, Please help me to solve my problem 我没有获得传递给控制器的任何价值,请帮助我解决问题
I tested it and it's working fine. 我测试了它,并且工作正常。 See code below and check if there's a difference 请参阅下面的代码,并检查是否有区别
HTML HTML
<form class="col s12" enctype="multipart/form-data" action="<?php echo site_url();?>/extras/transactions/12333" method="post">
<div class="row">
<div class="input-field col s12">
<input placeholder="Amount" type="text" required name="amount" id="amount">
</div>
</div>
<div class="btn-area">
<button class="btn waves-effect waves-light " type="submit" name="action">Update</button>
</div>
</form>
PHP PHP
function transactions($id = NULL){
echo "ID: ".$id;
echo "<br>";
echo "AMOUNT: ".$this->input->post('amount',TRUE);
}
OUTPUT OUTPUT
https://i.stack.imgur.com/e8Rqo.png https://i.stack.imgur.com/e8Rqo.png
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.