Slightly odd include(); output...

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
User avatar
Weasel5-12
Forum Commoner
Posts: 37
Joined: Tue Sep 16, 2008 6:58 am

Slightly odd include(); output...

Post by Weasel5-12 »

G'day guys...

i know this may sound newbie, buts its confusing me like crazy so i thought if i should see if i could get some1 else's opinion on my little problem...

as im including a .inc file called dataOutputTable_1.inc i store it in a variable say... $output, at which point i echo out the $output and its should.. display as it would before i threw it into the .inc file right?? WRONG. =)

at the end of the .inc file... in the output only, its showing up with the number 1...


here's my php section..

Code: Select all

$output = include("dataOutputTable_1.inc");
echo $output;
 
Simple enough right..?

now my .inc file is a fair bit bigger to throw up here... so ill throw up a sample..
inc section...

Code: Select all

<table>
    <tr>
      <td>Number of ingredients: </td>
      <td>
        <input type='text' name='numOfIngredients' value="<?php echo $ingredientNum?>" readonly='readonly' />
      </td>
    </tr>
  </table>
  Are the above details correct?
<br><input type='submit' value='Correct'></form>

It is at the end of my form tag, that im getting the output of 1.

some1 please help? hahaha
cheers guys
-Weasel
User avatar
arjan.top
Forum Contributor
Posts: 305
Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia

Re: Slightly odd include(); output...

Post by arjan.top »

remove echo $output;
User avatar
Weasel5-12
Forum Commoner
Posts: 37
Joined: Tue Sep 16, 2008 6:58 am

Re: Slightly odd include(); output...

Post by Weasel5-12 »

cheers bro ! ahahhaah

thx for answerin so quickly
ahowell
Forum Newbie
Posts: 17
Joined: Mon Sep 01, 2008 9:18 pm

Re: Slightly odd include(); output...

Post by ahowell »

You don't even need to pass the include into a variable. Just include it...

Code: Select all

include 'dataOutputTable_1.inc';
User avatar
Weasel5-12
Forum Commoner
Posts: 37
Joined: Tue Sep 16, 2008 6:58 am

Re: Slightly odd include(); output...

Post by Weasel5-12 »

sorry mate, just curious why. =p

Is it because the function include(); is returning true or some other reason?

cheers
Post Reply