I have a form that is using $_post to get to an insert.php page. The $_post info looks like this when I do a print_r
Array (
[extension] => Array (
[0] => 100
[1] => 101
[2] => 102
)
[secret] => Array (
[0] => a467ca4044f298eff15a26e59f39fe21
[1] => 0c4275de171ef363b77aa6aae27afff1
[2] => c1951bfb07ed6a833d6d785ff4e19123
)
[phone] => Array (
[0] => 80828703658A
[1] => 80828703D858
[2] => 80828703F866
)
[template] => Array (
[0] => Another 600 Template
[1] => Another 600 Template
[2] => Another 600 Template
)
)
The insert.php page only inserts the data from extension and secret. Not the phone or template data. The phone and template data gets into the array by dropdown boxes in the original form. here's the code I am using
// Escape user inputs for security
$ext = mysqli_real_escape_string($link, $_POST['extension']);
$secret = mysqli_real_escape_string($link, $_POST['secret']);
$macaddress = mysqli_real_escape_string($link, $_POST['phone']);
$templatename = mysqli_real_escape_string($link, $_POST['template']);
// attempt insert query execution
$sql = "INSERT INTO assignments
(id, extension, secret, macaddress, template)
VALUES (null,'$ext', '$secret', '$macaddress', '$templatename')";
if(mysqli_query($link, $sql)){
echo "Records added successfully.";
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
// close connection
mysqli_close($link);
?>
Where am I going wrong? Thanks