Hi there again, fretburner, I’ve managed to need help with this again!
I’ve modified the draggable stuff to include three checkboxes, since I need to offer selections with the two text boxes. Unfortunately, PHP can’t see unset checkboxes and it’s messing up the ordering of the checkboxes. I tried the entire day to find a way to make radio buttons look like checkboxes, etc. but I can solve this whole problem if I change the way this table works.
Here’s the form in it’s current … well, form.
https://wheeltastic.com/test.html
The important bit:
[code]
<tr>
<td><input type="checkbox" name="specfull[]" checked="checked"> <input type="checkbox" name="specbrief[]"> <input type="checkbox" name="specsort[]" checked="checked"></td>
<td><input class="form-control" name="specname[] id="specname[]" placeholder="Name" value="Fits" type="text"></td>
<td><input class="form-control" name="specval[] id="specval[]" placeholder="Value" value="Onx6 10" Light Bars" type="text"></td>
<td><a class="btn btn-delete btn-danger">Delete</a></td>
</tr>
<tr>
<td><input type="checkbox" name="specfull[]"> <input type="checkbox" name="specbrief[]"> <input type="checkbox" name="specsort[]"></td>
<td><input class="form-control" name="specname[] id="specname[]" placeholder="Name" value="Name" type="text"></td>
<td><input class="form-control" name="specval[] id="specval[]" placeholder="Value" value="New Value" type="text"></td>
<td><a class="btn btn-delete btn-danger">Delete</a></td>
</tr>
</tbody>
</table>[/code]
Instead of allowing PHP to number the array elements, I need to dictate it, making it instead look like this:
[code]
<tr>
<td><input type="checkbox" name="specfull[1]" checked="checked"> <input type="checkbox" name="specbrief[1]"> <input type="checkbox" name="specsort[1]" checked="checked"></td>
<td><input class="form-control" name="specname[1] id="specname[1]" placeholder="Name" value="Fits" type="text"></td>
<td><input class="form-control" name="specval[1] id="specval[1]" placeholder="Value" value="Onx6 10" Light Bars" type="text"></td>
<td><a class="btn btn-delete btn-danger">Delete</a></td>
</tr>
<tr>
<td><input type="checkbox" name="specfull[2]"> <input type="checkbox" name="specbrief[2]"> <input type="checkbox" name="specsort[2]"></td>
<td><input class="form-control" name="specname[2] id="specname[2]" placeholder="Name" value="Name" type="text"></td>
<td><input class="form-control" name="specval[2] id="specval[2]" placeholder="Value" value="New Value" type="text"></td>
<td><a class="btn btn-delete btn-danger">Delete</a></td>
</tr>
</tbody>
</table>[/code]
And then when new ones get added, they get the next number as well as renumbering them when I drag them around.
Here’s the frustrating part. I know this can be done because before I altered it, the function used to automatically place a chronological number at the front of each row. I just can’t figure out how to make it instead place that number in my element names
<input class="form-control" name="specval[] id="specval[]" placeholder="Value" value="New Value" type="text">
becoming
<input class="form-control" name="specval[2] id="specval[2]" placeholder="Value" value="New Value" type="text">
I hope that’s not too confusing. I’ve hurt my thinker a bit over this.