php gurus get in here please

Q-Report New Topic Comment
2 following
129 views - Last viewed 27 Feb 2021

Abraham Catalyst: php gurus get in here please Jan 21 2021

Guys I need help.
So I have a form with this input field.

<input type="text" name="resp[]">

Then I have a JS that adds more of this field up to 10 and  everything looks good.

I now have an Ajax request that sends the form data for to my server.

Ok?, When posting, I send like 3* data through the field which should go as an array...

In my server, if I check for the post request like so:

var_dump($_POST['resp']);

It shows that an array was sent correctly (with each element represented correctly)..

But when I try to loop through the array to print a single element like so:

 foreach($_POST['resp'] as $key=> $resp){

echo $resp.'<br>';

}

It prints only one data from the array of 3*.

PS: I'm using $key because that is not the only data sent to the server... So I'll have to loop through the other data using the key e.g

 $POST['fname'][$key]
11 likes 5 comments #view likers
➥All Replies
Drop ReplyDo not add emoji