开发者

how to get value of hidden fields in controller?

开发者 https://www.devze.com 2022-12-29 19:02 出处:网络
how do i get the value of hidden field from controller? i tried this: $hidden=$this->input->post(\'hidden_field_name\');

how do i get the value of hidden field from controller?

i tried this:

$hidden=$this->input->post('hidden_field_name');

it showed 开发者_JAVA百科error. The field name is correct, i double checked it.


Try $_POST['hidden_field_name'];

If that doesn't work, then it's because that field_name doesn't exist.


Make sure your HTML is right first. If it's not in "View Source" then it's not going to work.

Then:

var_dump($_POST);

If you see the item you want in there, grab it with $this->input->post();

var_dump() is your friend, use it every time you are confused.


very easy !

i have used

form_hidden('username', 'johndoe');

// Would produce:

<input type="hidden" name="username" value="johndoe" />

and i have got no chance of gettig a POST DATA , sucks :( right?.

It was this change i made it very easy as it should be again.

Remember: you need to give ID.

<?php echo "<input type='hidden' name='source' id='source' value='addStoreForm' />"; ?>

ALLOHA!

0

精彩评论

暂无评论...
验证码 换一张
取 消