473,394 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Why is "include" printing my code instead of executing it?

Hi,

I'm using PHP 4.4.4 with Apache 2 on Fedora Linux. I have a page,
which contains (roughly)

$sub_cat_name_arr = split(",",
trim($_REQUEST[PROD_SUB_CATEGORIES_ID_PARAM]));
foreach ($sub_cat_name_arr as $sub_cat_name) {
/* Processing */

include("add_product_response.inc");
} // foreach

header("confirmation.html");

But what is happening is that the contents of
"add_product_response.inc" (which only contain PHP code that doesn't
generate HTML) are being printed out to the screen instead of being
executed. Any idea why this is happening and how I can change the
behavior so that the code in the include file is executed?

Thanks, - Dave

Oct 24 '07 #1
4 4037
la***********@zipmail.com pisze:
Any idea why this is happening and how I can change the
behavior so that the code in the include file is executed?
missing opening tags ?

z.
Oct 24 '07 #2
"la***********@zipmail.com" <la***********@zipmail.comwrote in
news:11*********************@t8g2000prg.googlegrou ps.com:
Hi,

I'm using PHP 4.4.4 with Apache 2 on Fedora Linux. I have a page,
which contains (roughly)

$sub_cat_name_arr = split(",",
trim($_REQUEST[PROD_SUB_CATEGORIES_ID_PARAM]));
foreach ($sub_cat_name_arr as $sub_cat_name) {
/* Processing */

include("add_product_response.inc");
} // foreach

header("confirmation.html");

But what is happening is that the contents of
"add_product_response.inc" (which only contain PHP code that doesn't
generate HTML) are being printed out to the screen instead of being
executed. Any idea why this is happening and how I can change the
behavior so that the code in the include file is executed?

Thanks, - Dave
change the extension and call "add_product_response.php" ?
Oct 24 '07 #3
On Oct 24, 2:28 pm, zdzisio <zdzi...@poczta.xz.plwrote:
laredotorn...@zipmail.com pisze:
Any idea why this is happening and how I can change the
behavior so that the code in the include file is executed?

missing opening tags ?

z.
Yup, that was it. I forgot to put "<?php" and "?>" tags in my
included file. - Dave

Oct 24 '07 #4
..oO(la***********@zipmail.com)

What is this:
header("confirmation.html");
?

Micha
Oct 25 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

43
by: steve | last post by:
I am quite frustrated with php’s include, as I have spent a ton of time on it already... anyone can tell me why it was designed like this (or something I don’t get)? The path in include is...
2
by: steve | last post by:
Hi, I need to do conditional script "include", but like to pull the code from db instead of a file. How do I do that? Reason: I like to implement some complex regex logic, and make it table...
7
by: mescaline | last post by:
Hi, Suppose a_file.cpp contains a function a_function() Now to include it in main_file.cpp I just do #include "a_file.cpp" and I'm all set. i recently came across this seemingly roundabout...
6
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing...
12
by: Pablo Suarez | last post by:
When I code #include "myheader.h" then this header file is searched in the current directory. But where does the compiler search the header file when I write #include <myheader.h>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.