Hiii... I can get an array from $_POST['C'] to my PHP file. I need to send it to the database. Here I have posted what I tried.
<?
if(!empty($_POST['G'])){
for($i=0;$i<sizeof($_POST['C']);$i++){
var_dump($_POST['C']);
$Query="INSERT INTO Questions(Questions_ID,Question_Name) VALUES($i+1,'$_POST[C][$i]')";
if(!mysqli_query($con,$Query)){
die("<script>alert( \"Error: ". mysqli_error($con)."\");window.location.href='FormCreationTrial.php';</script>");
} }
}
?>
This is the var_dump of the array. array(3) { [0]=> string(1) "A" [1]=> string(5) "Male2" [2]=> string(7) "Female2" } Notice: Array to string conversion in C:\xampp\htdocs\PHIS\FinalSubmissionOfTheFormPHP.php on line 19. Line 19 is where I have written the query.
When I'm trying to send the array one by one it gives me an error like ' Duplicate entry 'Array[0]' for key 'Question_Name_UNIQUE'. Please someone help me to solve this.