Jump to content

Unwanted Extra Character Is Being Appended To An Include File...


the_opposite

Recommended Posts

Hi,

 

This is my first post - I hope it does not break any rules! Here goes...

 

I have a file called include.php which contains just 6 numbers. Say for example "123456"

I include this file into another php webpage using the standard include command i.e.

 

<frame src="http://www.example_url.com/mailshot/<?=include("includes/include.php")?>" name="mainFrame" id="mainFrame" />

 

However, the include is displayed as "1234561" - An extra "1" has been added and I can't work out why?

 

I have double checked the include file - it only contains 6 characters (the file size is just 6 bytes).

 

How can I prevent this extra character being appended to the include file?

 

Many thanks for any help :)

 

Jason

 

Its because your echoing the include() which will always return "true" aka "1"..

 

What exactly are you doing, trying to get a link from a page? How about create a variable in that file and then do

 

<?php $link = "blah/blah/bl.txt"; ?>

<?php include("include/include.php"); ?>
<frame src="http://www.example_url.com/mailshot/<?=$link?>" name="mainFrame" id="mainFrame" />

The "<?=" is shorthand for "<? echo" which you don't want when including a file. The "1" is being returned by the include() function as an indication of success and the "echo" is sending that to the screen. Try:

<frame src="http://www.example_url.com/mailshot/<?php include("includes/include.php")?>" name="mainFrame" id="mainFrame" />

 

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.