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

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

am 24.10.2007 21:20:16 von laredotornado

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

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

am 24.10.2007 21:28:39 von zdzisio

laredotornado@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.

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

am 24.10.2007 21:39:04 von Good Man

"laredotornado@zipmail.com" wrote in
news:1193253616.087715.41200@t8g2000prg.googlegroups.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" ?

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

am 25.10.2007 00:08:04 von laredotornado

On Oct 24, 2:28 pm, zdzisio wrote:
> 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 "" tags in my
included file. - Dave

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

am 25.10.2007 17:04:18 von Michael Fesser

..oO(laredotornado@zipmail.com)

What is this:

> header("confirmation.html");

?

Micha