Re: Include???

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Daniel Brown wrote:
On 5/23/07, Jim Lucas <lists@xxxxxxxxx> wrote:

Dan Shirah wrote:
> Okay, I think I'm doing everything right, but for whatever reason my
> include
> isn't working.
>
> <?php
> echo $_POST['status_code'];
> if ($_POST['status_code'] = "C") {
>  include ('complete_save.php');
> }
> ?>
>
> The echo of my status_code retruns the correct value so the if should
> trigger.
>
> This is my include page:
>
> <?php
>
> echo "test";
>
> ?>
>
> VERY simple, but for some reason is not working????
>
I think to this point most have missed the actual problem.

imho, it has nothing to do with the following line.

if ( $_POST['status_code'] = "C")

my reason for saying this is this.  The preceding condition will always
return true.

<?php

$a = 'a';
if ( $a = "C" ) {
        echo '$a test success';
}

$c = 'C';
if ( $c == "C" ) {
        echo '$c test success';
}

?>

This snippet should prove my point.

so, I would have to say that the problem is not with the condition, but
rather the include file itself.

--
Jim Lucas

    "Some men are born to greatness, some achieve greatness,
        and some have greatness thrust upon them."

Unknown

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



   That's true as well, Jim.... but the OP included the include file code
at the foot of the message, and it's valid (a simple echo statement).

   Dan, try adding this to the top of your code:
ini_set('error_reporting',E_ALL);

   If it outputs any errors for you, then you'll know what's up.  Also, you
don't need a space in your include command.  Just type it out as if it were
a function: include('complete_save.php');

but include is not a function.  it is a Control Structure

http://us2.php.net/manual/en/language.control-structures.php

imo, the op should not use parentheses when calling it

Look here

http://us2.php.net/manual/en/function.include.php

out of all the examples, only one of them shows include being called with parentheses.

The one that does use the parentheses is an example of when not to use parentheses.

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Unknown

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux