I am trying to process a user defined length form (i.e. if the user types in 4, then the form has 4 fields)
And i am trying to process all the fields into an array
I thought a for loop would be best:
the number of fields equal to the amount they chose is printed on the page. Once they fill it in, and press submit i need to process them into an array. I was wondering if this would work:
for($i=1; $i <= $_SESSION['number_of_exercises']; $i++)
{
$workout_names[$i] = [COLOR=red]$_POST['workout_name$i'];[/COLOR]
}
will $_POST['workout_name$i']; work? cus i did not know if $i would be processed within the quotes.
also do i need to declare $workout_names as an array, or if i could just make it one by using the statement in the for loop.