Scenario:
I have a drop-down box that displays Wood Types (Cherry, White Oak, Poplar, Walnut, etc.) The display routine, with other code, is in a separate PHP program called "Shop.php".
There is another PHP routine called "Edit.PHP" that is used to do maintenance on the various databases of the application.
Here is my problem. The following is the output when I click on the drop down box in the Shop.php program
[text]In the Wood Type drop down box, the result looks like this:
White Oak
Cherry
<------ a blank line here.
Poplar
Walnut[/text]
How did I get this:
In the Edit.php routine, I deleted an existing record in the Wood database and entered a couple new ones.
The code in the Edit.php routine looks like this:(there is additional code in the Edit.php routine but I did not show it.)
Code: Select all
function deleteEntry(index, table, deleteImage)
{
var sql = "DELETE FROM "+table+" WHERE `index` = "+index;
if(deleteImage != "")
{
deleteImage = "images/"+deleteImage;
}
document.location = "edit.php?sql="+sql+"&deleteImage="+deleteImage;
}
var woodPhotos = new Array (<?php for($i = 0; $i < sizeof($photos); $i++) { if($photos[$i][3] == 'wood') { if($first == false) { echo ","; } $first = false;?> new Array('<?php echo $photos[$i][1]; ?>', '<?php echo $photos[$i][2]; ?>') <?php } } ?> );
Code: Select all
<?php for($i = 0; $i < sizeof($woods); $i++)
{?>
<tr>
<td><?php echo $woods[$i][0];?></td>
<td id="name<?php echo $i; ?>"><?php echo $woods[$i][1]; ?></td>
<td id="image<?php echo $i; ?>"><img id="imageWood<?php echo $i; ?>" width="100" height="80" src="images/wood/<?php echo $woods[$i][2]; ?>" /></td>
<td><input type="button" id="btnEdit<?php echo $i; ?>" onclick="editEntry(<?php echo $i; ?>, <?php echo $woods[$i][0]; ?>)" value="edit" /></td>
<td><input type="button" onclick="deleteEntry('<?php echo $woods[$i][0]; ?>', 'wood')" value="delete" /></td>
</tr>
<?php }?>