What is the right syntax for code above?
$_POST[firstname{$i}], $_POST[firstname+$i], $_POST[firstname.$i]
I searched over and over again but I couldn't find any answer yet : /
How am I suppose to put the $i after those names?
What is the right syntax for code above?
$_POST[firstname{$i}], $_POST[firstname+$i], $_POST[firstname.$i]
I searched over and over again but I couldn't find any answer yet : /
How am I suppose to put the $i after those names?
try this
$firstname = $_POST['firstname'.$i];
and user $firstname
variable in your query
You cannot use array subscripts in a string like that. You'd have to write "{$_POST['firstname'.$i]}"
(you were also missing the quotes around the first part of the array subscript, such as 'firstname').
If you plan on doing that though, you will open your application to hackers (read here on how to prevent sql injections in php).