1

I have used multi-dimesional array from a database to bring back a row ($dataTotal) and another one to bring back a position in that row ($data['position1']) depending on if I want to display anything in the array on that first page

When the user clicks on a link, I would like the page to override the existing value of the $data array, and pass that new value to a new page where I can display different positions of that same array. For e.g $data['position2'].

Page 1

 <a href="../webapp/pages/influencer/person.php?data=<?php $data =  $dataTotal[0]; echo $data; ?>"

Page 2

$data = $_GET['data']; echo $data['position2'];

My only problem is that it shows that Im passing a string with this link. So incompatible datatypes.

1 Answers1

0

for this purpose you can use serialize() function to convert a array to a string and then encode it with urlencode(). example:

<a href="../webapp/pages/influencer/person.php?data=<?php $data =  $dataTotal[0]; echo urlencode(serialize($data)); ?>";

$data = unserialize(urldecode($_GET['data'])); 

echo $data['position2'];