I have an application you can view here: APPLICATIONPlease follow steps below in order to use the application correctly:[*]Click on the \[code\]Add Question\[/code\] button twice to append 2 table rows in the table underneath. [*]Both table row will have their own file input. In both file inputs upload a video file (I advised a very small video for quickness of upload). You will have to upload video file one at a time[*]You will see that every time a file is uploaded, underneath the table it will display a text input, the values in the text input is the video id from the database associated for each video file uploaded.So for example if my Video table currently looks like this:Video Table:\[code\]VideoId (auto PK) VideoFiles4 Files/video1.mp4\[/code\]If I upload 2 video files (\[code\]video5.mp4\[/code\] and \[code\]video6.mp4\[/code\]) and the text inputs state \[code\]5\[/code\] and \[code\]6\[/code\] respectively, then it means the \[code\]Video\[/code\] table now looks like thi afterthe upload of files:Video Table: \[code\]VideoId (auto PK) VideoFiles4 Files/video1.mp45 Files/video5.mp46 Files/video6.mp4\[/code\]Now code for displaying the text inputs is below:Jquery when upload finishes and generates text input:\[code\]function stopVideoUpload(success, videoID, videofilename){ var result = ''; if (success == 1){ result = '<span class="videomsg'+videocounter+'">The file was uploaded successfully</span>'; $('.hiddenvid').append('<input type="text" name="vidid[]" id="'+videoID+'" value="' + videoID + '" />'); } $(sourceVideoForm).find('.videof1_upload_process').hide(); $(sourceVideoForm).find('.videomsg').html(result); $(sourceVideoForm).find('.videof1_upload_form').show(); return true; }\[/code\]Div tag where it stores text inputs:\[code\]<div class="hiddenvid"><!-- All uploaded video file ids go here --></div>\[/code\]Now the issue is below, I want to store in the database which question contains which videos. To do this I will store the question numbers in the \[code\]Question\[/code\] Table, giving it a \[code\]QuestionId\[/code\] and want to retrieve the \[code\]VideoId\[/code\] of the video from the \[code\]Video\[/code\] Table. So below is what the database tables should look like when submitting and inserting your video files into the db:Question Table:\[code\]QuestionId (auto PK) QuestionNo25 126 2\[/code\]Video_Question Table:\[code\]VideoQuestionId (PK auto) VideoId QuestionId7 5 258 6 26\[/code\]The issue I am having is I am struggling to INSERT the data for the \[code\]Video_Question\[/code\] table. The inserting into the \[code\]Question\[/code\] Table is fine but what I am trying to do is retrieve the last \[code\]QuestionId\[/code\] submitted and for each \[code\]QuestionId\[/code\], retrieve any \[code\]VideoId\[/code\] which belongs to that \[code\]QuestionId\[/code\] and insert it into the \[code\]Video_Question\[/code\] Table?Below is my attempt but nothing is inserted into the \[code\]Video Question\[/code\] table, it is giving me an:\[code\]Notice: Undefined offset: 0 in .... on line 305 error\[/code\] How can I fix the error and get the INSERT for the \[code\]Video_Question\[/code\] to work?Below is the code for the insert (I have commented the line number where the notce appears):\[code\] $videoquestionsql = "INSERT INTO Video_Question (VideoId, QuestionId) VALUES (?, ?)"; if (!$insertvideoquestion = $mysqli->prepare($videoquestionsql)) { // Handle errors with prepare operation here echo __LINE__.': '.$mysqli->error; } $vidresults = $_POST['vidid']; foreach($vidresults as $vidid => $vidvalue) { $video = $vidvalue; $vidquesid = $question_ids[$vidid]; foreach($vidvalue as $video) {$insertvideoquestion->bind_param("ii",$video, $vidquesid); $insertvideoquestion->execute(); if ($insertvideoquestion->errno) { // Handle query error here echo __LINE__.': '.$insertvideoquestion->error; break 4; } }}\[/code\]By doing the following var_dumps:\[code\]var_dump($question_ids);var_dump($vidid);\[/code\]I get these results:\[code\]array(2) { [1]=> int(159)[2]=> int(160) } int(1)\[/code\]