I've been trying out arrays recently, and this is my coding:

<?php
$data = array('autoguide1'=>'car',
              'baz'=>'boom',
              'scotland'=>'haggis',
              'php'=>'hypertext processor');

echo http_build_query($data); // autoguide1=car&baz=boom&scotland=haggis&php=hypertext+processor
echo http_build_query($data, '', '&amp;'); // foo=bar&amp;baz=boom&amp;cow=milk&amp;php=hypertext+processor

?>

What I want to try and do is make my PHP code run so that I can include a file from another page on my site, e.g.
http://mysitehere-localhost.com/testing.php?yourpage&scotland=haggis

and depending on the URL it will take the array and use the generated query string.

Thanks.

Do you mean you want to generate a hyper link on the page using the the items in the array? Sort of like this:

echo '<a href="http://mysitehere-localhost.com/testing.php?yourpage' . http_build_query($data) . '">my link</a>';

The 'yourpage' bit of the link is throwing me (what's it for?) a bit so maybe I haven't quite got what you want to do.

Sorry if I have misunderstood, hope this helps ...
Simon.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.