2

I got this piece of code that shows output from a database in a table. The last column shows the output on a button and can be clicked to go further. I am looking for a way to style the button with css, but its not doing what i need at all.

<?php
    while($row = mysqli_fetch_array($result)){
        ?>

        <tr align="center">
            <td><?php echo $row['klasse']; ?></td>
            <td><?php echo $row['orde']; ?></td>
            <td><?php echo $row['onderorde']; ?></td>
            <td><?php echo $row['familie']; ?></td>
            <td><?php echo $row['onderfamilie']; ?></td>
            <td><?php echo $row['soort']; ?></td>
            <td><?php echo $row['ondersoort']; ?></td>

            <?php
            $output = $row['ned_naam'];
            echo "<td> <a href='info.php?value=". $output ."'><button>" . $output . "</button></a> </td>"; 
        echo "</tr>";
    }
    ?>

I tried:

<button class=\'btn\'>" . $output . "</button></a> </td>";

but that doesn't seem to work at all. What am i doing wrong?

1
  • What do you want to do? its not clear from the question. Commented Feb 9, 2020 at 6:45

1 Answer 1

2

There is no reason to use escape character \ on single quote since you wrapped your echo in double quotes

echo "<button class='btn'>" . $output . "</button>";
Sign up to request clarification or add additional context in comments.

1 Comment

thanks, tried that too before and it wouldn't show the button at all. Same happened again, but then i realized that 'btn' was a reserved class for bootstrap (which i use also). So i changed it to <button class='bttn'> and it worked like a charm. Thanks for waking me up :).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.