Kedar B
Kedar B

Reputation: 784

How to pass array as parameter through url in codeigniter

I have simple html code where I want to pass two arrays through url.

<a href="<?php echo base_url()."index.php/account/print_bs/$data/$data1";?>" target="_blank">PRINT</a>

Where $data and $data1 are two associative arrays. But it gives me error array to string conversion..So how do I do that??

Upvotes: 1

Views: 2980

Answers (1)

Rizier123
Rizier123

Reputation: 59701

You can't just append an array to the url. What you could do is to save them in the session and then you have access to them on the next site like this:

site1:

<?php

    session_start();

    $_SESSION["array1"] = $data;
    $_SESSION["array2"] = $data1;

?>

site2:

<?php

    session_start();

    print_r($_SESSION["array1"]);
    print_r($_SESSION["array2"]);

?>

Upvotes: 2

Related Questions