Before I start outlining the problem, I know that hyphens in variable names are bad juju
I'm using a JavaScript date picker to populate some drop-down menus. In the form, the code for the "which day of the month" drop-down menu looks like this:
Code: Select all
<select id="date-sel-dd" name="date-sel-dd">
...
</select>Code: Select all
foreach($this->form_array as $key => $value) {
$val = $key;
$$val = $value['value'];
}Does anyone know of a way to escape the array key so that the dynamically-created variable is assigned correctly? The date picker script is going to be a bit of a nightmare to edit so I'd like a quick win on this one if possible.
Thanks in advance - and a big shout out to all those developers working hard this weekend, keeping the economy ticking over for everyone and setting a good example generally!
Mecha Godzilla