I want to display images associated with a record. The number of images varies, up to a max of 8. I have the correct php (shown here)
PHP Code:
 if(!empty($row_rs_details['image1'])){ 
  echo 
"<img src=\"http://www.sitepoint.com/forums/images/",$row_rs_details['image1'],"\"><br>"; }
  if(!empty(
$row_rs_details['image2'])){ 
  echo 
"<img src=\"http://www.sitepoint.com/forums/images/",$row_rs_details['image2'],"\"><br>"; }
  if(!empty(
$row_rs_details['image3'])){ 
  echo 
"<img src=\"http://www.sitepoint.com/forums/images/",$row_rs_details['image3'],"\"><br>"; }
..../ 
etc. for 8 images 
This works great. But all that repetition is perfect fodder for a for loop, so I tried one, thusly
PHP Code:
  for ($i 1$i <= 8$i++) {
  
$image "image".$i;
  if(!empty(
$row_rs_details['$image'])){ 
  echo 
"<img src=\"http://www.sitepoint.com/forums/images/",$row_rs_details['$image'],"\"><br>"
  }

Which doesn't work so great. When I echo $image alone it shows the correct value (i.e. image1, image2, etc.), therefore I must be missing a quote or double quote or escape somewhere. I need another pair of eyes to see what I'm missing.

Thanks