0

I'm transmitting values from a page to an other this way:

 <a href="page_name.php?<?php echo base64_encode($value_new ?>=
                       <?php echo base64_encode($values_new); ?>">

How can I get these values on another page by using base64_encode ?

Here is the URL when I use base64_encode:

page_name.php?YW1vdW50=MTQ5OQ==YW1=MTQ5OQvdW50

Please give me any suggestion if any one has.

2
  • base64_encode produces string, containing equal signs among others. Hence it’s not possible to use the value it returns as is in query params. Your code even does not have matched parenthesis. You might want to urlencode the value, and do base64_decode on the handler page, but at the moment this code is far from being usable. Commented Nov 22, 2014 at 6:44
  • Why are you doing base64_encode for the parameter key? Commented Nov 22, 2014 at 6:46

2 Answers 2

1

You are doing with wrong syntax, the correct way to do that is below - (if you have two values)

<a href="page_name.php?value1=<?php echo base64_encode($value_new1);?>&value2=<?php echo base64_encode($value_new2);?>">Send</a>

Now on the other page(page_name.php) get these values as -

$value1 = base64_decode($_GET['value1']);
$value2 = base64_decode($_GET['value2']);

echo $value1;
echo $value2;

you can also add multiple values by adding - &value3 = (thisvalue).

May this help you

Sign up to request clarification or add additional context in comments.

1 Comment

Oh really? base64_encode’d string contains equal signs (aka =’s.)
0

Try by this way

<a href="page_name.php?value_new=<?php echo base64_encode($values_new); ?>">

And access in another page by using

echo base64_decode($_GET['value_new']);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.