I have a form that someone can add multiple phone numbers and extension, and I am trying to save them in the database, whenever I save the data it shows the word "Array" in both filed.
Here is my code so far:
if (!empty($_POST['Phone']) && isset($_POST['Extension'])) {
foreach ($_POST['Phone'] as $key => $value) {
foreach ($_POST['Extension'] as $key => $value2) {
$para = array("UserID" => \PDO::PARAM_INT, "Phone" => \PDO::PARAM_STR, "Extension" => \PDO::PARAM_STR);
$val = array($_SESSION['UserID'], $_POST['Phone'], $_POST['Extension']);
$r = DB::Call("[spPhoneInsert]", $para, $val);
}
}
if (count($r) > 0 && $r[0]['Result'] == 'Ok') {
header("location:home.php?added_phone=1");
} else {
header("location:home.php?error_phone=1");
}
exit;
}