Need help with php ->echo

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nriv08
Forum Newbie
Posts: 3
Joined: Wed Aug 20, 2008 11:33 am

Need help with php ->echo

Post by nriv08 »

Hi,
Im trying to hyperlink a file to a text in php. however, the hyperlink contains a unique number stored in a variable that is appended to the actual xls name at the end of my program i have developed. i am echo-ing through a php script.

echo'<p>MS Excel File:</p>';
echo'<a href=$session . "final_results.xls">EXCEL DOCUMENT OF RESULTS</a>';

is there something wrong in my href? $session contains the unique number that is appended to the the xls file.

When the web page is displayed and i click on the "EXCEL DOCUMENT OF RESULTS", it shows that it is referencing it to $session and not the "unique#"+final_results.xls
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Need help with php ->echo

Post by aceconcepts »

Replace:

Code: Select all

 
echo'<a href=$session . "final_results.xls">EXCEL DOCUMENT OF RESULTS</a>';
 
// with
 
echo'<a href="' . $session . '_final_results.xls">EXCEL DOCUMENT OF RESULTS</a>';
 
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: Need help with php ->echo

Post by RobertGonzalez »

It has to do with how you are trying to display your variables. Double quotes and single quotes work totally different. Read up on strings in the manual. It explains it pretty well.
Post Reply