I'm trying to upload a posted array into a database table. From within the form the user writes the text that should be uploaded into the database. What I've read and understood is that I should create the array like this:
<li> <input type='checkbox' name='R[]' id='R[]'> <label>"+ userInput + "</label> </li>
and that every element the user creates will become R[0], R[1], R[2]..... etc...
my question is, how do I read this array within server side? How do I know how many elements are in the array from server side?
On server side I'd do an insert like this:
$sql="INSERT INTO $tbl_name (R) VALUES('$R1');";
$sql2="INSERT INTO $tbl_name (R) VALUES('$R2');";
if it wasn't an array I'd simply define R1 and R2 like this:
$R1=$_POST["R1"];
$R2=$_POST["R2"];
but I don't get how to manage the array.
Thanks!