mrkhan Posted July 20, 2016 Posted July 20, 2016 Hello, i am trying to search page with multiple options like, i have one select box where i can select multiple items as <select id="tokenize" name="tokenize" multiple="multiple" class="tokenize-sample" /> i have GET form and when i submit the form i get values like search/?tokenize=abc&tokenize=xyz now in my search page $children = $pages->find("template=property, Ad_Type=".$ptype." ,Area=".$tokenize); as you can see i have passed multiple values of tokenize, how can i search page contains all values ? Thanks 1
Francesco Bortolussi Posted July 21, 2016 Posted July 21, 2016 Hi, maybe you could pass your variables as Array. You should name your select <select name="tokenize[]" > Then when you receive it, create an "OR" type of condition for the selector, using a foreach to iterates over it, or maybe a function. $customOrSelector = implode("|", $_GET['tokenize']); And finally, apply it to your query: $children = $pages->find("template=property, Ad_Type=".$ptype." ,Area=".$customOrSelector); Hope this help. NOTE: Don't use this example in a production environment, is not safe to use variables directly from $_GET or any other user input without sanitize them.
adrian Posted July 21, 2016 Posted July 21, 2016 Have a read of this post: It should explain everything you need. 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now