Reputation: 275
I've looked around for a solution to this problem but I can't find one. I am trying to make a payment method for opencart.
I have two fields(ID and key) set in the admin area which I then proceed to retrieve from controller of the front end page
(using this->config->get)
These fields are used to carry out encryption in a separate PHP file.
(Passing these as arguments)
However one of the compulsory fields (Key) has an '&'
which is converted to '& amp ;'
I used
htmlspecialchars_decode
Function to get rid of this and any other html char problems that I might face.
But I am still not getting the correct encryption. I cross checked by directly sending the key as string instead of using this->config->get
.
Any thoughts and help? Thanks!
Upvotes: 1
Views: 608
Reputation: 551
html_entity_decode($data, ENT_QUOTES, 'UTF-8');
the function coverts all htmlentities()
to their original characters.
e.g.,
$string = 'Cinema 30" & Laptop';
echo html_entity_decode($data, ENT_QUOTES, 'UTF-8');
will output Cinema 30" & Laptop
Upvotes: 0
Reputation: 15151
You could simply use str_replace()
to convert the &
back to &
as you retrieve it in the controller
<?
// REPLACE VAR
$string=str_replace("&", "&", $data);
?>
Upvotes: 1