1
I’m wanting to receive the form data with loop, I located an example like this:
foreach($_POST as $nome_campo => $valor) {
$comando = "$" . $nome_campo . "='" . $valor . "';";
eval($comando);
}
However I don’t know how I can do to record or edit this data in the database.
I do not know if it is possible, because this variable $comando
shows me nothing outside the foreach
.
I want to take:
Name, email, password, Obs via _POST form and add to the database using a loop, so you don’t have to:
$nome = $_POST['nome'];
$email = $_POST['email']
...
and have these data stored in the database.
Why are you wearing the
eval
?– Jéf Bueno
This code there is not only not safe, using the
eval
in user data, could be replaced only by functionextract
:extract($_POST)
. And which database are you using? Have you been able to connect it? What is the table structure?– Woss
So I want to receive data with loop and write to the mysql database and get this code there by searching for it in google. I don’t know how to do it, more precise.
– JB_