Attaching a variable to url

I have this URL:

<img src="">

In the place of number I want to put a SESSION variable.How am I going to do it?
I have tried various syntax…without success…one of them is the one below.

<img src=""<?php echo $_SESSION['fb_userID']; ?>"/picture">

What is the correct syntax for embedding a variable in this URL above?

I’d imagine the problem is the extra quotation marks before and after your embedded PHP code - once the sessionID is in place it reads like this:

<img src=""050340"/picture">

I’d do this instead, but just because I don’t like PHP embedded within a line, you could probably just lose those quotes.

$url = "" . $_SESSION['fb_userID'] . "/picture";
echo '<img src="' . $url . '">';

yes…that worked…thanks.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.