<ul class="items">
<li>
<span class = "item">
<?php
while ($row=mysqli_fetch_assoc($result))
{
foreach ($row as $key=>$val)
{
echo "{$val} " . " <br/>";
echo "<br /><hr /><br />";
}
}
mysqli_free_result($result); ?>
<a href="#" class="done-button">Mark as done</a>
</span>
</li>
</ul>
I'm trying to add this into the loop:
href="#" class="done-button">Mark as done
aka - a Mark as Done
button for a To-Do List, so that it appears next to each value that's outputted. However, I can only get it at the bottom of the page.
You're close! All you need to do is move the link inside of your loop, like so (I'm not sure exactly where you want your button):
<ul class="items">
<li>
<span class = "item">
<?php
while ($row=mysqli_fetch_assoc($result))
{
foreach ($row as $key=>$val)
{
echo "{$val} " . " <br/>";
echo "<br /><hr /><br />";
}
echo '<a href="#" class="done-button">Mark as done</a>';
}
mysqli_free_result($result); ?>
</span>
</li>
</ul>