php - How to hide get parameter from url in codeigniter

310

I want to hide get parameter from url.

I have URL like domain.com/controller/function?clear=1

I want to remove ?clear=1 from URl and want to URL like: domain.com/controller/function

it is possible in codeigniter but how ? i saw some similar question here but i can't found proper solution.

108

Answer

Solution:

This is not possible to hide the get parameter. You can use ajax to send the parameter like this

        var id = "your parameter which you want to send in the url";
        $.ajax({
            url:"<?php echo site_url('controller/function');?>/"+id,
            success:function(data)
            {



            }

            });
        }

Try this for more link

180

Answer

Solution:

You can usebase64_encode before send data and when you catch that in Controllerbase64_decode

Examples of Encoding & Decoding Encrypted PHP

In View

<a href="<?php echo base_url()?>Controller_name/Method/<?php base64_encode('Im the value')?>"

In Controller

public function Method($id)
{
   $valid_id = base64_decode($id);
}

People are also looking for solutions to the problem: php - Imagick:UnableToLoadModule

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.