CHEBURASHKA
CHEBURASHKA

Reputation: 1713

How to include a html string dynamically

I want to include a dynamic name for my picture

<img src='uploads/'"<?php echo $pic; ?>">

In the above code $pic = myCatImage.jpg

But it does not work

How can I do this ?

Upvotes: 2

Views: 46

Answers (1)

John Conde
John Conde

Reputation: 219804

Your quotes are off:

<img src='uploads/<?php echo $pic; ?>'>

This value goes inside the same quotes as the rest of the value of the src attribute.

Upvotes: 5

Related Questions