I guess this is small issue but yet i had to ask here since i am running short in my project. When I pass string to the function in another controller, it changes spaces into %20 sign. I guess the controller thinks the string passed as url and encodes it. But I don't know exactly how to remove it or if possible do not let it to change spaces into %20. Here is the code which i use;
$message="The user name you provided is already in our database";
redirect('admin/add_user/'.$message);
Here is my controller function where i receive the message;
public function add_user($message)
{
echo $message;
}
I also tried this as;
public function add_user()
{
echo $this->uri->segment(3);
}
But the result is same. Here is the output of the string;
The%20user%20name%20you%20provided%20is%20already%20in%20our%20database
Try this:
public function add_user($message)
{
echo urldecode($message);
}
You can read more about urldecode here: http://php.net/manual/en/function.urldecode.php
Try this:
echo urldecode($message);
because you are passing the message as part of the URL (The redirect does a new http request) it is automatically url encoded. You just need to decode it once the server receives it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With