Configurable script to turn $_POST in to 'pretty' string to email
$15-20 USD
Terminado
Publicado hace más de 15 años
$15-20 USD
Pagado a la entrega
We need a PHP function which will take the $_REQUEST var (or any array) and create a string out of the key/values. However we must be able to configure the following:
1.) The keys need to be replaced with 'prettier' text. So we will need hash to map between the two. For example:
'first_name' => 'First Name',
'last_name' => 'Last Name'
So if the form has an input with the name 'first_name' it would be displayed as 'First Name'.
2.) Which keys actually used. This will be a white list of all keys that will be used any others will be ignored. This can be an array of keys. Example:
'first_name', 'last_name', 'address'
3.) Each key/value pair will start on a new line.
--
function MakeString($_REQUEST, $white_list, $mapping) => string