include() function issue

  • JonDoeCA
  • Newbie
  • Newbie
  • JonDoeCA
  • Posts: 7

Post 3+ Months Ago

I'm seeing the weirdest thing with an include function, (assuming it's the include() function that's the culprit). To resolve an issue I was experiencing, I eliminated all but the following code to find the error. Now I just need to find out why my code is behaving like it is. I've narrowed it down to only two small pages...

form.php
HTML Code: [ Select ]
<?php
<!-- all php code removed so I can rule out possible conflicting code/variables... -->
?>
<div id="div1"><?php include("divFiller1.php"); ?></div>
  1. <?php
  2. <!-- all php code removed so I can rule out possible conflicting code/variables... -->
  3. ?>
  4. <div id="div1"><?php include("divFiller1.php"); ?></div>



divFiller1.php
PHP Code: [ Select ]
<?php
$newInput='<input type="text" value="blah">';
echo $newInput;
echo $newInput;
?>
 
  1. <?php
  2. $newInput='<input type="text" value="blah">';
  3. echo $newInput;
  4. echo $newInput;
  5. ?>
  6.  


The output is two text boxes; 1 WITHOUT a value of 'blah' and the other WITH a value of 'blah'. Why wouldn't they both be the exact same output? Any ideas?

Thanks Guys!
Jay
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9090
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

That is very strange, from the code you posted I would think they would be the same too. Are you seeing this when you view the actual source code too? Or is it just doing this in the browser? Have you tried putting a name on your input fields, I could see some browsers having problems with you not putting an id or name on the text fields.
  • JonDoeCA
  • Newbie
  • Newbie
  • JonDoeCA
  • Posts: 7

Post 3+ Months Ago

I didn't have the code anymore so I recreated it from this post and just tried it again. It worked this time. I have no idea why it didn't work before. Regarding the browsers, I had also tried it in safari and it did the same thing. I'm wonding if it's possible to have had a random non-visible character in my code somewhere?

Anyway, thanks for checking it out and replying.

Jay
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9090
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

No problem! It is possible I suppose, still that is strange behavior. Too bad we really won't ever know what the cause was. Glad you got it fixed, if even by luck ;)
  • ScottG
  • Proficient
  • Proficient
  • ScottG
  • Posts: 477

Post 3+ Months Ago

Some versions of front page express add a strange hidden character to the very beginning of files I had that happen to an entire website that was done in php and every time we tried to do a header redirect we would get a headers error. once we found it we did a massive replace on it to get rid of it and switched to another coding program

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 83 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.