How to change the variable name numbering in ascending order to assign values to them. eg: car_1, car_2, car_3, car_4........ so on.. my coding is something like;
for (i=1; i<20;i++){
$var[i] = $_POST["car_"i];
}
foreach ......so on........
echo $var[12]."<br/>";
I need a way to increase the number of 'car_' to assign each car value to the '$var' array. I have tried to add it like this:
$var[i] = $_POST["car_"&i];
AND
$var[i] = $_POST["car_"i""];
and none of these work. I would very much appreciate your help to solve this.
If you mean to append strings then do this:
for ($i=1; $i<20;$i++) {
$var[$i] = $_POST["car_".$i];
}