I am currently working on a blog that consists of entries. I have included a form with hidden variables to delete posts by submitting the entry ID and other data. However, I am facing an issue where the delete button always displays below the entry instead of alongside it.
To resolve this problem, I attempted using CSS Clear and consolidating all elements within a single <p>
tag, but without success. It appears that the presence of a form with hidden variables is causing the misplacement, yet I am unsure of how to rectify this issue.
<div id="subformposts">
<?php echo $subentry['Body']; ?>
<?php echo $subentry['CreateDate']; ?> - <?php echo $subentry['UserName']; ?><br />
<!-- Determine whether to show the delete button -->
<form action="Delete_entry.php" method="post" id="Deletesub<?php echo $subentry['EntryID'];?>" onsubmit="return confirmdelete('Deletesub<?php echo $subentry['EntryID'];?>')">
<input type="hidden" readonly="true" name="EntryID" value="<?php echo $subentry['EntryID']; ?>" />
<input type="hidden" readonly="true" name="UserID" value="<?php echo $subentry['UserID']; ?>" />
<?php if ($userid == 1 || $userid == $res['UserID']) { ?>
<input type="image" src="redx.png" alt="Delete Post" id="btnDelete" value="Delete Post" />
<?php } ?>
</form>
</div>
I aim to reposition the delete button to float to the right side of my entry (or even to the left). It would be ideal if I could nestle it within the div container seamlessly.