2
I have this code:
<?php
foreach ($_POST as $dados =>$value) {
$list = explode('_', $value);
echo '<pre>' . print_r( $list, TRUE ) . '</pre>';
?>
It generates the 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 way out:
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 record 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 that?
What is the original output? The format of the array you are running with foreach? Take an example and improve the display of the above sff code
– Miguel
I didn’t understand the question you have more fields to put information beyond the
nome
?– rray
yes ray I have 11 fields:, I just did not put everything not to get too extensive the question:
– Clayton Campos