Setting a “where” value from a form selection (revisit)

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

By gregThomas - May 22, 2013 - edited: May 22, 2013

Hi Jerry,

I think you just need to modify your where statement so that it's blank if a value of no is selected:

<?php 
 
  $where = ""; 

  if (@$FORM['where'] == 'a') { $where = "male = '1'"; }

  list($attendance_testRecords, $attendance_testMetaData) = getRecords(array(
    'tableName'   => 'attendance_test',
    'where' => $where, 
  ));

?>

So if male is selected the $where value will be "male = '1'" else it will be left blank.

Let me know if you have any questions.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By gkornbluth - May 22, 2013

Hi Greg,

I could swear I tried that, but I guess not :-(

Anyway, it works and thanks!

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php