I'm trying to create a mail form customizer but now I'm stuck about creating dynamic keys to be used as checkbox fields.
My example PHP file:
$name = 'Jonh';
$userKey = 'SomeKey';
$userValue = 'SomeValue';
$customArray1 = 'SomeKey';
$customArray2 = 'SomeKey';
$customSubArray1 = array(1,2,3);
$customSubArray2 = array('apple','orange');
$array = array (
'Name' => $name,
$userKey => $userValue,
$customArray1 => $customSubArray1,
$customArray2 => $customSubArray2
);
I can get those values and keys using foreach to be sent by mail using phpmailer class:
$row = '';
foreach ($array as $key => $value) {
$row .= "$key"." - "."$value";
}
echo $row;
Then the PHP show:
Name Jonh UserKey UserValue Array Array
I'm retrieving data submited by the user from a database. How can I let the user create the any keys and values as they want and retrieve it? These keys must be string or child array.