2

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 ?

1 Answer 1

5

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.

Sign up to request clarification or add additional context in comments.

Comments

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.