Hello, I would like to ask if this code can be modified so that the images that are selected via the form are echoed in rows of three's as opposed to one image per row.
heres the extended version of the code, try selcting any check and you'll see that the images are echoed like this:
image
image
image
instead of:
imageimageimage
the code:
<?php
// if the form has not been posted, display the form:
if(!isset($_POST['submit']))
{
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<table cellpadding="5" cellspacing="0" border="0">
<tr>
<td><img src="http://i17.photobucket.com/albums/b69/Mhsjrotc/ar2.gif" alt="N-1-1" border="0" /></td>
<td><FONT COLOR= #FFFFFF; FONT FAMILY= Arial>
<input type="checkbox" name="awards[1]" value="N-1-1" />
Distinguished Cadet
</FONT></td>
</tr>
<tr>
<td><img src="http://i17.photobucket.com/albums/b69/Mhsjrotc/ar3.gif" alt="N-1-2" border="0" /></td>
<td><FONT COLOR= #FFFFFF; FONT FAMILY= Arial>
<input type="checkbox" name="awards[2]" value="N-1-2" />
Academic Excellence
</FONT></td>
</tr>
<tr>
<td><img src="http://i17.photobucket.com/albums/b69/Mhsjrotc/ar4.gif" alt="N-1-3" border="0" /></td>
<td><FONT COLOR= #FFFFFF; FONT FAMILY= Arial>
<input type="checkbox" name="awards[3]" value="N-1-3" />
Academic Achievement Ribbon
</FONT></td>
</tr>
</table>
<br />
<input type="submit" name="submit" value="Create Rack!" />
</FORM>
<?php
}
// else, process the submitted data:
else
{
if(!isset($_POST['awards']))
{
echo 'You did not make a selection. Please go back.';
}
else
{
// array of images:
$images[1] = 'http://i17.photobucket.com/albums/b69/Mhsjrotc/ar2.gif';
$images[2] = 'http://i17.photobucket.com/albums/b69/Mhsjrotc/ar3.gif';
$images[3] = 'http://i17.photobucket.com/albums/b69/Mhsjrotc/ar4.gif';
// loop through the posted values:
foreach($_POST['awards'] as $key=>$value)
{
echo '<img src="'.trim($images[$key]).'" alt="'.$value.'" /><br />'."\n";
}
}
}
?>
thanks in advance!