set default name_min and name_max values

3 posts by 2 authors in: Forums > CMS Builder
Last Post: March 18, 2013   (RSS)

Hi,

I would do something like this:

  //If the form hasn't been submitted, set default values
  if (@!$_REQUEST['searchData']){
    $_REQUEST['num_min']  = 10 ;
  }

  // load records from 'blog'
  list($blogRecords, $blogMetaData) = getRecords(array(
    'tableName'   => 'blog',
    'perPage'     => '10',
    'loadUploads' => true,
    'allowSearch' => true,
  ));

?>


<!-- This hidden input is just used to detect if the form has been submitted -->
<input type="hidden" name="searchData" value="yes" />
<input type="text" name="num_min" value="" />

<input type="submit" name="submit" value="Search" />
</form>


<?php showme($blogRecords); ?>

So I'm using the searchData variable in the form to detect if the form has been submitted. If it hasn't then I set the $_REQUEST['num_min'] value, and the getRecords function will use this to filter its result. 

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By Joef5 - March 18, 2013

So that worked perfectly.  Thanks!