trinity Posted December 9, 2008 Share Posted December 9, 2008 Hi, I'm here with more questions again, please excuse my ignorance as I am a complete beginner when it comes to PHP. I have a table where each row displays a filename and then a link to what should be a new page, that will open and decrypt the aforementioned file. How do I make this work? I know I need to be doing something with session variables and get data, read() or file_get_contents(). I'd be thankful if someone could give me a fairly simple explanation of how this could be done. Quote Link to comment https://forums.phpfreaks.com/topic/136232-solved-sessions-read-file_get_contents/ Share on other sites More sharing options...
trinity Posted December 9, 2008 Author Share Posted December 9, 2008 Ok, I have echo "<a href="FileDisplay.php?filename=<? echo $filename; ?>">Click here</a>"; with which I get some kind of syntax error, I have also tried: echo "<a href="FileDisplay.php<?php echo (isset($filename) ? '?filename=' . $filename : ''); ?>">"; with this I get another syntax error, 'unexpected $end' on this line. I'm not sure if I need to include something else. Can anyone help? Quote Link to comment https://forums.phpfreaks.com/topic/136232-solved-sessions-read-file_get_contents/#findComment-710666 Share on other sites More sharing options...
JonnoTheDev Posted December 9, 2008 Share Posted December 9, 2008 Sessions are for storing data without the need to pass through GET or POST requests so this is not really what you are after. file_get_contents() simply reads the contents of a file. If you are a beginner you should read the http://php.net functions manual to see what functions do, what parameteres they expect and what they return. Your syntax is bad: echo "<a href="FileDisplay.php?filename=<? echo $filename; ?>">Click here</a>"; Use echo "<a href=\"FileDisplay.php?filename=".$filename."\">Click here</a>"; You need a PHP beginners book mate. Quote Link to comment https://forums.phpfreaks.com/topic/136232-solved-sessions-read-file_get_contents/#findComment-710672 Share on other sites More sharing options...
trinity Posted December 9, 2008 Author Share Posted December 9, 2008 Yeah thanks for that, that's all I needed. I'm female not male by the way like the 'mate' suggests haha. And I am getting a beginners book now! Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/136232-solved-sessions-read-file_get_contents/#findComment-710741 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.