I have this code:
<?php
foreach ($_POST as $dados =>$value) {
$list = explode('_', $value);
echo '<pre>' . print_r( $list, TRUE ) . '</pre>';
?>
It generates array output:
Array
(
[0] => Manoel da Silva
)
Array
(
[0] => [email protected]
)
Array
(
[0] => (21)2481-3232
)
Array
(
[0] => 41106
)
Array
(
[0] => 21215430
)
But I want the output to be like this:
Array
(
[1] => Manoel da Silva
)
Array
(
[2] => [email protected]
)
Array
(
[3] => (21)2481-3232
)
Array
(
[4] => 41106
)
Array
(
[5] => 21215430
)
After that, I want to save the values in the database, but something is going wrong:
$conn = conecta();
foreach ($_POST as $dados =>$value) {
$cadastro = $conn->prepare('INSERT INTO clientes(:nome) VALUES $value');
$cadastro->bindValue(':nome', $value); //to colocando um valor só...
$cadastro->execute();
}
I want to enter the separate information in the bank, how do I do this?