I have many checkboxes and on check push them to an array and passing values to next page. Next page need for submitting selected and on submit I should pass an array to next page and do insert to Oracle DB. The problem that on print_r
i can see my array, but on an insert, I got the error Notice: Array to string conversion in ...
.
here is code how I pass data to next page and receive it:
What I do wrong?
P.S. I wrote function that will parse data and insert and need to pass data as this example(1,2,1,1*5,5,6,2*7,3,4,5)
Here is my printed data Array ( [0] => 6 [1] => 1 [2] => 1 [3] => 5* [4] => 10 [5] => 1 [6] => 1 [7] => 5* [8] => 14 [9] => 1 [10] => 1 [11] => 5* [12] => 18 [13] => 1 [14] => 1 [15] => 5* )
if(some condition) {
//here i check checkboxes, pshing values to array
} else if(isset($_POST["arrayforfirst"])){
$arrayforfirst = $_POST['arrayforfirst'];
$arrayforfirst2 = unserialize(base64_decode($arrayforfirst));
print_r($arrayforfirst2);
$query = "my insert query";
$stmt1 = oci_parse($my_connection, $query);
oci_execute($stmt1);
} else {
$newarray = array();
foreach($_POST['myarray'] as $id => $value) {
$pp = explode(",", $value);
array_push($newarray, $pp[2], $pp[3], $pp[4], $pp[1].'*');
}
echo '<input type="hidden" name = "arrayforfirst" value="'.base64_encode(serialize($newarray)).'" />';
}