Jump to content

Only the last value of my array is return


jcb789

Recommended Posts

Hi everyone

for my end of studies projects I decided to do a little e-commerce problem on the filter .. I use an ajax request at the click of the checkbox this goes to my controller which calls a method of my Model class but the concern is that .. if the array $ _POST ['brands'] has several elements then only the last one is returned to me? I thought I saw one day that if the same variable is in a url then the last value will be returned to me is for security but how can I do ... I have been there for too long .. and finally despair. . Help me please... :')

request payload:

brands%5B%5D=arai&brands%5B%5D=bell

reply :

<- prepare var_dump ()
object (PDOStatement) # 2 (1) {["queryString"] => string (73) "SELECT mark FROM articles WHERE categorie_article =? AND mark IN (?,?)"}

string (4) "arai" <- bind
string (4) "bell" <- bind

var_dump () of my fetchAll ()
array (2) {[0] => array (2) {["brand"] => string (4) "bell" [0] => string (4) "bell"} [1] => array (2 ) {["brand"] => string (4) "bell" [0] => string (4) "bell"}}
image_icon

since the last value taken into account is bell then I get two items of the bell brand from my bdd but no arai ...

Edited by jcb789
error
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.