Jump to content

Search by input parameter


Alex Rubinshtein
 Share

Recommended Posts

Hi Alex,

Welcome to ProcessWire and the forums... :)

Not sure what error you are getting but I am guessing the problem is the ->id part. A $pages->find will return and array of pages (i.e. there will be multiple ids); so, you only need $pages->find("age>$minAge"). You can then iterate through them.

See examples here:

http://processwire.com/api/variables/pages/

Secondly, nothing to do with your error, but you need to sanitize your input values first. In this case, you need to do at least this:

$minAge = (int) $input->get['minAge'];

The above are quick examples...you might need to sort out your double versus single quotes in the selector...I often forget which is which :-)...I might have missed something....others will correct if I did :D

Edited by kongondo
  • Like 2
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...