Search code examples
phphtmlhyperlinkechohref

How do I echo a clickable URL in PHP?


How do I echo a clickable URL in PHP? i want to makes this code as a clickable link, so i can click it, but i got no idea how to make it. Please help me if you know this case.

picture of the problem code

and these are my code :

<div class="container-fluid">

    <div class="card">
        <div class="card-header">Detail Shelter</div>
        <div class="card-body">

        <?php foreach($shelter as $slt): ?>
        <div class="row">
            <div class="col-md-4">
                <img src="<?php echo base_url().'/upload/'.$slt->gambar ?>" class="card-img-top">
            
            </div>
            <div class="col-md-8">
                <table class="table">
                    <tr>
                        <td>Nama Shelter</td>
                        <td><strong></strong><?php echo $slt->nama_shelter ?></td>
                    </tr>
                    
                    <tr>
                        <td>Lokasi Shelter</td>
                        <td><strong></strong><?php echo $slt->lokasi_shelter?></td>
                    </tr>
                    
                    <tr>
                        <td>Deskripsi</td>
                        <td><strong></strong><?php echo $slt->deskripsi ?></td>
                    </tr>

                    <tr>
                        <td>Telpon</td>
                        <td><strong></strong><?php echo $slt->no_telp ?></td>
                    </tr>


                 </table>

                <?php echo anchor('dashboard/index',
                '<div class="btn btn-sm btn-danger"> Kembali </div>') ?>    
            
            </div>

        </div>
        <?php endforeach; ?>
        </div>
    </div>

</div>

Solution

  • You just need to do this : <a href="<?php echo $slt->lokasi_shelter; ?>" class="">click here</a>