Page 1 of 1

Need help with php ->echo

Posted: Tue Oct 07, 2008 9:58 am
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

Re: Need help with php ->echo

Posted: Tue Oct 07, 2008 10:19 am
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>';
 

Re: Need help with php ->echo

Posted: Tue Oct 07, 2008 12:08 pm
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.