-1

I need to add some css to my PHP app. Im using bootstrap and I'm having problems with implementation of php inside html

<div class="container" id="tvrtkeLista">
<?php if($result){ ?>
    <table class="table">
        <thead class="thead-dark">
            <tr>
                <th scope="col">Naziv</th>
                <th scope="col">Opis</th>
            </tr>
        </thead>
            <tbody>
            <?php
            while(list($tvrtkaId,$naziv,$opis)=mysqli_fetch_array($result)) { ?>
                <tr>
                <td><a  href='detalji.php?id=$tvrtkaId&naziv=$naziv'> <?php echo "$naziv" ?> </a></td>
                <td> <?php echo "$opis" ?> </td>
                </tr>
                <?php }
                  } ?>
            </tbody>
    </table>

It's just a table styling but and it looks oke but my values now are not transfered onto next script.

brika28
  • 65
  • 8
  • 1
    [`http_build_query`](https://www.php.net/manual/en/function.http-build-query.php) See: [How to properly create HTML links in PHP?](https://stackoverflow.com/q/55366208/1839439) – Dharman Jul 26 '19 at 17:44
  • Add `;` after you `echo` your values and before you leave PHP with `?>`. – Dave Jul 26 '19 at 19:45

1 Answers1

-2

Okay I found the solution..

<td><?php echo "<a href='detalji.php?id=$tvrtkaId&naziv=$naziv'> $naziv </a>";?></td>

I had to wrap the whole anchor tag inside echo.

brika28
  • 65
  • 8