我想在Controller中獲得發佈值,這樣我就完成了我的代碼。 控制器類似這樣帖子值沒有越過codeigniter
public function save_expense($id = NULL)
{
$data['amount'] = $this->input->post('amount',TRUE);
var_dump($data['amount']);
print_r($data['amount']);
}
我查看文件看起來像這樣
<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>
我的.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>
我沒有收到所傳遞的任何值給控制器,請幫我解決我的問題
它正在做什麼? – TimBrownlaw
它是否在調用控制器?在save_expense()函數中註釋所有內容並添加echo「test」; exit;檢查你的控制器是否被調用 –
@TimBrownlaw其顯示空值 –