php if then based on checkbox
2 posts by 2 authors in: Forums > CMS Builder
Last Post: December 5, 2008 (RSS)
By bruno - December 5, 2008
I'm trying to display (or not display) an image based on a check box selection :
I keep getting this error:
Notice: Undefined variable: record in /home/brookspr/public_html/properties/test.php on line 25 Warning: Invalid argument supplied for foreach() in /home/brookspr/public_html/properties/test.php on line 25
...not sure what im doing wrong. I attached the php file
Thanks!
<?php
require_once "/home/brookspr/public_html/cmsAdmin/lib/viewer_functions.php";
list($propertiesRecords, $propertiesMetaData) = getRecords(array(
'tableName' => 'properties',
'perPage' => '10',
));
?>
<?php foreach ($record['main_photo'] as $upload): ?>
<?php if ($record['featured_property'] == "1"): ?>
<img src="<?php echo $upload['urlPath'] ?>" border="0" alt="<?php echo $upload['info1'] ?>" />
<?php else: ?>
<?php endif ?>
<?php endforeach ?>
I keep getting this error:
Notice: Undefined variable: record in /home/brookspr/public_html/properties/test.php on line 25 Warning: Invalid argument supplied for foreach() in /home/brookspr/public_html/properties/test.php on line 25
...not sure what im doing wrong. I attached the php file
Thanks!
Re: [bruno] php if then based on checkbox
By Dave - December 5, 2008
Hi Bruno,
The "undefined variable" usually means you are trying to use a variable that isn't set. In this case it's record. When you see that search for the variable to see if it's being set somewhere.
Try adding this foreach loop around all your code:
<?php foreach ($propertiesRecords as $record): ?>
<?php endforeach ?>
Hope that helps!
The "undefined variable" usually means you are trying to use a variable that isn't set. In this case it's record. When you see that search for the variable to see if it's being set somewhere.
Try adding this foreach loop around all your code:
<?php foreach ($propertiesRecords as $record): ?>
<?php endforeach ?>
Hope that helps!
Dave Edis - Senior Developer
interactivetools.com
interactivetools.com