Jump to content

How to style in while loop?


wesley

Recommended Posts

Hello,

I select data from a database in a while loop. But I want to style the data with CSS.

my question is: How can I make this like the uploaded image example?

my code is:

echo "<div>";


while ($record = mysqli_fetch_assoc($result)) {
    
    $id = $record ['foto_id'];
    $titel = $record['titel'];
    $img = $record['img_thumb'];
    
    echo "<h3>$titel</h3>";
    echo "<h4>Beoordelingen</h4>";
    echo "$id";
    echo "<img src='$img' alt='image'> ";
    echo "<div>";
    echo "Beoordeling: <input type='text' name='beoordeling' maxlength='4' size='4'/> (Ja/Nee of ?) <br />";
    echo "Commentaar: <textarea rows='4' cols='25'></textarea>";

    echo "Commentaar: <textarea rows='4' cols='25'></textarea>";

    echo "Commentaar: <textarea rows='4' cols='25'></textarea>";

    echo "Commentaar: <textarea rows='4' cols='25'></textarea>";
   

}
echo "</div>";
echo "</div>";

thanks in advance

image.jpg

Link to comment
Share on other sites

From what I see, you require the loop to create four independent containers, therefore you require current opening divs inside the loop, with single textarea, then single opening closing div outside to envelope the indepent containers.

By applying id or class to outer container OR class (as they are multiple) to outer independent container you then are able to reference child elements for styling.

Edited by dsonesuk
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...