Vote count: 0
So this is not really a problem I am having but I was hoping to get some feedback on how I am processing the form data sent to the server.
I am dealing with gigantic form with tons of select boxes, each with a large number of options.
For simplicity sake, let's say this is how the form looks like:
On the server, I need to, among other things, generate a PDF report. Obviously, on submission, the code above will send "volvo" instead of "Volvo XC90", which is what I will need to display to end users on reports, and so on.
Currently (as always, but I just realized this is a pain given how large the form is), I have written a function to make the values "pretty" again. Something like this:
function returnPretty($uglyArr) {
$pretty_csv = array(
"volvo"=>"Volvo XC90",
"saab"=>"Saab 95",
"merc"=>"Mercedes SLK",
"audi"=>"Audi TT",
);
$prettyArr = array();
foreach($uglyArr as $column) {
if($pretty_csv[$column]) {
$value = $pretty_csv[$column];
array_push($prettyArr, $value);
} else {
array_push($prettyArr, $column);
}
}
return $prettyArr;
}
Is there a better way of doing this? Especially when I am working with NoSQL.
Thanks.
HTML 5 Form Element Value
Aucun commentaire:
Enregistrer un commentaire