0
I have an array $_POST['form']['clima']
that in this example has the value below
array(2){
[0]=> string(1) "1"
[1]=> string(1) "2"
}
I need to take these values to join with $id (in this example will be 3) to bring the result below ($id, value of each array):
(3, 1),
(3, 2)
How can I do that?
I tried that, but you repeated the 2:
$id = 3;
foreach($_POST['form']['clima'] as $clima){
$todos = '('.$id.','.$clima.')';
$todos.=','.$todos;
}
The result of what I did:
(3,2),(3,2)
Could describe in the question what he tried to do and the result obtained?
– Woss
opa, I put there what I did
– Leandro Marzullo
You are overwriting the variable
$todos
within the loop.– Woss