Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 7th, 2011, 11:23 PM
Registered User
 
Join Date: Apr 2011
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default url as a variable

I have had no luck with this all day, someone please help. In the body of my php form I have:

$banner=links_files/image001.gif
<img src="$banner" />

but I do not get my image. I have also tried a few dozen other variations such as

$banner=links_files/image001.gif
<img src="<?echo $banner; ?>">

What am I doing wrong? I just want this to point and display a gif.
Reply With Quote
  #2 (permalink)  
Old April 8th, 2011, 01:00 AM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Try
Code:
<?php
$banner = "links_files/image001.gif";
echo "<img src=". $banner . ">"; 
?>
__________________
Om Prakash Pant
Click the "Thanks" button if this post helped you.
Reply With Quote
The Following User Says Thank You to om_prakash For This Useful Post:
Joe-Mama (April 10th, 2011)
  #3 (permalink)  
Old April 10th, 2011, 08:53 PM
Registered User
 
Join Date: Apr 2011
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks Om,
It was the clue I needed to get started. I am making a template for my my web pages. Each page will have a unique variable setting that will put the right images and such (like the banner on top) for each page. For the sake of anyone else that is getting started and trying to do this here is my variation of Om's code:
On index.php
<?php $banner = "index_files/headline.jpg"; ?>
<?php include "template.php"; ?>

Then in template.php

<?php echo "<img src=". $banner . ">"; ?>

I know it is simple but it helped me get started.
Thanks again Om!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
capture variable in URL Lemonluv07 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 March 31st, 2006 04:00 AM
capture a variable from url. .com?jblp jblp PHP How-To 1 October 25th, 2004 07:26 PM
passing a variable through URL katie456 Classic ASP Databases 2 January 20th, 2004 11:27 PM
prevent error if $_GET variable is not in URL mih100 Beginning PHP 1 September 6th, 2003 08:40 PM
catching an URL variable in xslt Flashlight XSLT 1 August 21st, 2003 01:32 AM



All times are GMT -4. The time now is 05:48 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.