Hi guys, I am asking kindly for a little php issue that im having. Im a newbie to php so im still getting my feet wet. But I am retreaving info from a file using the php include command. Here is the code im using. <?php include('fbnvideos.incl') ?> so my output is the info within the file as such. outputs: 123456789 and it pulls the info just fine. But when I use the php coding within a link html coding like below... <a href="<?php include('fbnvideos.incl') ?>">TESTING</a> this is the output link is this http://mysites/123456789<br /> Did you noitce that it added the <br /> code in the link? I think i may have figured out why it has done this. Its because in the "fbnvideos.incl" file there seems to be 2 lines. the 1st line contains the info which is: 123456789 and the 2nd line is blank. So the file looks like this example: line 1: 123456789 line 2: See yow line 2 is actually blank. Is this blank causing the <br /> code to appear. How can I stop this from happening? I know the simple way of doing this would be just to go into the file and delete the 2nd empty line but I dont have permission to edit the file because its own by the "root" of the server. can someone please help a newbie php coder. thanks a million in advance. Lavish
hi TR and thanks for the help. I have tried require, readfile, and include. It all gives me same results. Any more help and I would be very greatful.
you could try using strip_tags(); to strip the data of the <br> tags. so like <a href=<?php include(strip_tags('fbnvideos.incl')) ?>TESTING</a> Make sure to reumove the "" marks in your anchor text and it should work. I just tested it on my server. If it works don't forget the rep ^_^ =D
What browser are you using? Sometimes if the rest of your code doesn't specify the correct HTML tags (I don't know if you are actually using <html><body> to begin with) I believe IE will 'interpret' what it is given. Then the problem is that the 'show source' shows what it has rendered, not what it was actually sent. If you're using IE, try it in Firefox and see what happens as there is no real reason why that <br> is there (unless there's something weird going on in your include file).
Post us the exact code you are using. Is this being parsed by a template system, that template system may be converting new lines to line breaks. Try doing trim(file_get_contents('fbnvideos.incl'));