0

I have a multidimensional array. For each of the values in the array I want to create a URL:

<?php

$myArray = [
    [
        'name' => ` d a`,
        'surname' => `smith`,
        'place' => `a us`,
    ],
    [
        'name' => `d a e`,
        'surname' => `col`,
        'place' => `e n g land`,
    ],

 ];
include 'index_common.php';

and other file index_common.php URL is

 echo  "<a href=http://place/surname_action.php><h1>name</h1></a>";
nealio82
  • 2,611
  • 1
  • 17
  • 19

1 Answers1

-1

Iam not sure to understood you right, but I would guess the following is the solution for your problem:

See - http://docs.php.net/manual/da/function.http-build-query.php

There is a function given an array returns an querystring, see the following example from php manual.

<?php
$data = array('foo'=>'bar',
              'baz'=>'boom',
              'cow'=>'milk',
              'php'=>'hypertext processor');

echo http_build_query($data) . "\n";
echo http_build_query($data, '', '&amp;');

?>

foo=bar&baz=boom&cow=milk&php=hypertext+processor
foo=bar&amp;baz=boom&amp;cow=milk&amp;php=hypertext+processor

also supports complex / nested arrays

J. Knabenschuh
  • 747
  • 4
  • 15