/    Sign up×
Community /Pin to ProfileBookmark

How to do correct path in img URL?Simple question

I have code which gives me correct image like:

[code=php]
<?PHP
<img src=’../../images/image1.gif’>
?> [/code]

How to do it to define path URL with variable like: $_PATH3 and it will be validated as correct?

Need help

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@foxbeeflyJul 26.2007 — <?PHP

<img src='../../images/image1.gif'>

?>

first of all, I think this is the way I would write that code:

<?php

echo "<img src='../../images/image1.gif' />";

?>

next, I am assuming that you want create an image link using a path to a file that is in the variable $_PATH3 maybe from a database):

<?php

echo "<img src='".$_
PATH3."' />";

?>

I am concatenating (joining) the variable (or rather its vale) with the html I am echoing.

Hope this helps!
×

Success!

Help @toplisek spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...