Obtaining array in POST variable
Posted on 2015-02-19
I'm trying to find a way to obtain a subset array from the passed POST array in a php function. Right now my html form has one input into which a number is typed. Based on that value a number of checkboxes will appear after it. What would be the best way to obtain the array of checkbox values from the POST? I am submitting the form using AJAX and .serializeArray() for the form. Would it be best just to copy the array, trimming out the first entry, which is the first input value? So if the POST was: input=4 cb1=1 cb2=0 cb3=0 cb4=1, just create a separate array starting at index 1? If anyone has any ideas or opinions please let me know.