Skylink
Skylink

Reputation: 83

Passing Hidden value in anchor tag in codeigniter

I have the following anchor tag:

 <a href="<?php  echo base_url('admin/add_images'); ?>" class="btn green">Add New <i class="icon-plus"></i></a>

Here in base_url(admin/add_images), admin is name of controller, add_images is name of method in admin controller, I can do it in GET Method like base_url(admin/add_images?id=$id) however I am unable to pass it through POST method, to not shown it in url.

If you people have any idea or practice about it, then let me know. Thanks in advance.

Upvotes: 0

Views: 1981

Answers (1)

shaggy
shaggy

Reputation: 1718

If you want to pass "hidden" (it's not really hidden, but not visible for common users), you have two options:

1) change your <a> tag to <button> and put your hidden value inside hidden field.

<form method="post" action="<?php  echo base_url('admin/add_images'); ?>">
        <input type="hidden" name="id" value="<?php echo $id; ?>">
        <button type="submit" class="btn green">Add New <i class="icon-plus"></i></button>
</form>

2) if possible, use session, store your hidden value inside flashdata.

Upvotes: 1

Related Questions