SitePoint Sponsor |
|
User Tag List
Results 1 to 9 of 9
Thread: trying to echo image id
-
Jun 5, 2007, 04:49 #1
- Join Date
- Oct 2004
- Location
- uk
- Posts
- 853
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
trying to echo image id
Hi guys
trying to echo the id which is stored in $field6
PHP Code:echo"<img src=image.php?id='$field6'>";
many thanks in advance for your help
-
Jun 5, 2007, 04:54 #2
- Join Date
- Mar 2002
- Location
- Whistler, Canada
- Posts
- 51
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
-
Jun 5, 2007, 04:59 #3
- Join Date
- Oct 2004
- Location
- uk
- Posts
- 853
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
that didnt work
-
Jun 5, 2007, 05:06 #4
- Join Date
- Mar 2002
- Location
- Whistler, Canada
- Posts
- 51
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Well, that should pass $field6 to your image.php file. What's in your image.php file? Did you try to
PHP Code:echo $_GET['id'];
-
Jun 5, 2007, 05:12 #5
- Join Date
- Oct 2004
- Location
- uk
- Posts
- 853
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
$field6 is the id of the image
if i write it like this
echo "<img src=image.php?id=18>";
then it works fine
but I need to replace the value of 18 with field6
how would line be written with echo $_GET['id'];
-
Jun 5, 2007, 05:25 #6
- Join Date
- Mar 2002
- Location
- Whistler, Canada
- Posts
- 51
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Alternatively, you could try
PHP Code:echo '<img src="image.php?id='.$field6.'" alt="" />';
Are you sure $field6 is set properly?
Above the echo line, add
PHP Code:$field6 = '18';
-
Jun 5, 2007, 05:33 #7
Are you calling this from a database or is this a variable set earlier in the page?
In any case, when using a variable, you have to echo/print it:
PHP Code:echo "<img src=\"image.php?id=$field\" alt=\"\" />";
// Or
echo "<img src=\"image.php?id=".$field."\" alt=\"\" />";
-
Jun 5, 2007, 05:38 #8
- Join Date
- Oct 2004
- Location
- uk
- Posts
- 853
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Fixed it guys
thanks
-
Jun 5, 2007, 05:40 #9
Bookmarks