I am building a template for another program I use, and have spent many many hours trying to figure this out.
I have HTML checkboxes that are pulling in data using
selection[]
As the name.
Basically, the input data is formed into an array, which includes a number two times. This number needs to be dynamic but listed in order... 1, 2, 3 etc.
An example input list would be something like
This is $number example and $number is cool.
This $number is great but $number is better.
The proper output would be:
This is 1 example and 1 is cool.
This 2 is great but 2 is better.
Every solution I've found requires the numbers to be static, like for example exploding a list of numbers and using...
$numbers = "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15";
$numex = explode(" ", $numbers);
echo $number[0];
But since each selection is different, and every time different checkboxes will be selected, I need PHP to somehow insert the numbers dynamically.
Is this possible? I'm driving myself crazy trying to figure it out.
Update:
Here are samples of inputs:
$game1 = "C:\\Program Files (x86)\\games\\1\\template\\1";
$game2 = "C:\\Program Files (x86)\\games\\2\\template\\2";
$game3 = "C:\\Program Files (x86)\\games\\3\\template\\3";
$game4 = "C:\\Program Files (x86)\\games\\4\\template\\4";
Now, where the "1, 2, 3, 4" is, I need those numbers to be automatically inserted after the form is submitted. So for example, if only
$game3
$game4
Are selected, the output would be:
$game3 = "C:\\Program Files (x86)\\games\\1\\template\\1";
$game4 = "C:\\Program Files (x86)\\games\\2\\template\\2";
Does this make more sense?
Thank you for your time.