declare one variable

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • [ZaToPeK]

    declare one variable

    hello.
    in my linux machine in the php.ini i have register_global s on
    i one page i have:

    <?php
    if($que){
    echo($que);
    }
    ?>

    and appears this error:
    Notice: Undefined variable: que in c:\inetpub\wwwr oot\web\kk.php on line 2

    why?
    how can i solve it?

    (i am beggining wht php,sorry)
  • Johan Holst Nielsen

    #2
    Re: declare one variable

    [ZaToPeK] wrote:
    [color=blue]
    > hello.
    > in my linux machine in the php.ini i have register_global s on
    > i one page i have:
    >
    > <?php
    > if($que){
    > echo($que);
    > }
    > ?>
    >
    > and appears this error:
    > Notice: Undefined variable: que in c:\inetpub\wwwr oot\web\kk.php on line 2
    >
    > why?
    > how can i solve it?[/color]

    if(isset($que) && $que != '') {
    echo $que;
    }

    :)

    Regards,
    Johan

    Comment

    • Savut

      #3
      Re: declare one variable

      Check your php.ini file and change error_reporting = E_ALL ^ E_NOTICE so php
      wont check for undeclared variable. if you want to keep php to repport all,
      then you have to initialise your variable.
      $que = "" ; or $que = Null; //at the beginning

      Savut

      "[ZaToPeK]" <boli@excite.co m> wrote in message
      news:e0a18593.0 312020807.2feab d7d@posting.goo gle.com...[color=blue]
      > hello.
      > in my linux machine in the php.ini i have register_global s on
      > i one page i have:
      >
      > <?php
      > if($que){
      > echo($que);
      > }
      > ?>
      >
      > and appears this error:
      > Notice: Undefined variable: que in c:\inetpub\wwwr oot\web\kk.php on line 2
      >
      > why?
      > how can i solve it?
      >
      > (i am beggining wht php,sorry)[/color]


      Comment

      • Chung Leong

        #4
        Re: declare one variable

        echo @$que;

        Don't need to check to see if the variable is set. If it's empty, echo
        outputs nothing.

        Uzytkownik "[ZaToPeK]" <boli@excite.co m> napisal w wiadomosci
        news:e0a18593.0 312020807.2feab d7d@posting.goo gle.com...[color=blue]
        > hello.
        > in my linux machine in the php.ini i have register_global s on
        > i one page i have:
        >
        > <?php
        > if($que){
        > echo($que);
        > }
        > ?>
        >
        > and appears this error:
        > Notice: Undefined variable: que in c:\inetpub\wwwr oot\web\kk.php on line 2
        >
        > why?
        > how can i solve it?
        >
        > (i am beggining wht php,sorry)[/color]


        Comment

        Working...