phpfreak007 Posted April 8, 2011 Share Posted April 8, 2011 I am having difficulty working out how to grab from a URL within a URL a link to an image and display this image on a webpage. example: http://domainA.com/page1.php?file_image=http://domainB.com/image.jpg I know little of this the code below but this is not working: <?php echo $_GET['file_image']; ?> this just copies the url, whereas I want to display this image.jpg from domainB using image source by grabing it. <img src=" "> I hope you understand me. Quote Link to comment https://forums.phpfreaks.com/topic/233141-_get-command-help/ Share on other sites More sharing options...
Maq Posted April 8, 2011 Share Posted April 8, 2011 Whatever value is after the equals sign is exactly what you're going to get. file_image=http://domainB.com/image.jpg Either pass in the correct value, or use some string functions to extract it. Quote Link to comment https://forums.phpfreaks.com/topic/233141-_get-command-help/#findComment-1199014 Share on other sites More sharing options...
dcro2 Posted April 8, 2011 Share Posted April 8, 2011 Do you mean this? echo '<img src="'.$_GET['file_image'].'">'; Quote Link to comment https://forums.phpfreaks.com/topic/233141-_get-command-help/#findComment-1199027 Share on other sites More sharing options...
phpfreak007 Posted April 9, 2011 Author Share Posted April 9, 2011 dcro2 thank you that's exactly what I wanted many thanks to all and a nice forum Quote Link to comment https://forums.phpfreaks.com/topic/233141-_get-command-help/#findComment-1199051 Share on other sites More sharing options...
phpfreak007 Posted May 19, 2012 Author Share Posted May 19, 2012 I have a new query with reference to above slightly modified. (reference from above: http://domainA.com/page1.php?file_image=http://domainB.com/image.jpg) I now would like to know coding how to insert a hidden field within a simple href URL so that on clicking that URL it goes to the next page with the contents of 'file_image' copied to the end of the URL of the next page so e.g it becomes: http://domainA.com/page2.php?file_image=http://domainB.com/image.jpg I tried the code below but no luck: <a href='page2.php' input type="hidden" name="file_image" value="<?php echo $_GET['file_image']; ?>">page 2</a> Hope it makes sense. Quote Link to comment https://forums.phpfreaks.com/topic/233141-_get-command-help/#findComment-1346809 Share on other sites More sharing options...
wigwambam Posted May 19, 2012 Share Posted May 19, 2012 <a href='page2.php?file_image=<?php echo $_GET['file_image']; ?>'>File image</a> Quote Link to comment https://forums.phpfreaks.com/topic/233141-_get-command-help/#findComment-1346813 Share on other sites More sharing options...
phpfreak007 Posted May 19, 2012 Author Share Posted May 19, 2012 Thank You Quote Link to comment https://forums.phpfreaks.com/topic/233141-_get-command-help/#findComment-1346814 Share on other sites More sharing options...
smoseley Posted May 19, 2012 Share Posted May 19, 2012 Just wanted to add $_GET is not a command, it's a collection of parameters sent via the HTTP "get" request method. $_GET can be used like any array in PHP. Quote Link to comment https://forums.phpfreaks.com/topic/233141-_get-command-help/#findComment-1346815 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.