Home > Blockchain >  How to display an image on my page instead of pathname
How to display an image on my page instead of pathname

Time:05-30

I am trying to fetch image on my page but it's showing pathname instead, below is my code.

<td><?= $items['id']; ?></td>
<td><?= $items['fullname']; ?></td>
<td><?= $items['phone_no']; ?></td>
<td><?= $items['<img src="picture" />']; ?></td>

Here is the full code:

enter image description here

CodePudding user response:

You have some sort of mix up there. I gather that $items is an array. So you should give a key name to the image item, not the source you want to print. Store the path in (for example) $items['picture'] then you just echo the path inside the src attribute of an image element.

<td><?= $items['id']; ?></td>
<td><?= $items['fullname']; ?></td>
<td><?= $items['phone_no']; ?></td>
<td><img src="<?= $items['picture']; ?>"></td>
  • Related