I have to pass an associative array of email with the query string.
Please tell me how can I pass array with query string and how can I access the array element from there.
I have to pass an associative array of email with the query string.
Please tell me how can I pass array with query string and how can I access the array element from there.
You can use http_build_query()
which also supports multi-dimensional arrays.
Simple example:
$a["one"] = "Bob";
$a["two"] = "Alice";
$a["three"] = "John";
echo http_build_query($a);
The above example will output:
one=Bob&two=Alice&three=John
if you print_r($array_name)
is show array structer
Array
(
[0] => Array
(
[id] => 007
[name] => Abdulla
[online] => yes
)
)
if you want access those
echo $variables["array_name"][0]["name"]; //this will show the data
foreach($variables["array_name"] as $item)
{
$id = $item["id"];
$name = $item["name"];
$online = $item["online"];
}
read this Answer As well
To attch in email
$to = '';//email address
$subject = ''//subject here
$message = 'Name : '.$name.'online : '.$online;
mail($to, $subject, $message)//send mail