If user adds a name and they want to create multiple fields, they can put numeric values in a ranged format. If they type in A1-7
, it will create 7 names A1 A2 A3 A4 A5 A6 A7
. Deepening on the range, it creates the title according to provided range the user can use a comma to separate multiple ranges. Use a number range with a dash in-between to create multiple units in a row. Letters can be used before or after the first number in each range.
Example: A1-3, 5B-7
will create 6 units (A1, A2, A3, 5B, 6B, 7B
)
I tried using the explode function to first separate it by comma, but I am stuck on how to expand the ranges.
$units = array_map('trim', explode(',', $_POST['title']));