Re: Include???

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

 



On 5/23/07, Daniel Brown <parasane@xxxxxxxxx> 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');

include is a control structure, I believe it isn't required, but
preferred to use the include without (), like this:
include "complete_save.php";

And of course, you could use the return value of the include function
to check if the include was successful.

Tijnema

--
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