error...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mac

    error...

    hi,
    im new to php.can anybody please tell waht tis error is....

    Notice: Undefined index: empname in d:\instantrails \www\test\new
    \formsubmit.php on line 14


    thanx
    mac
  • Jerry Stuckle

    #2
    Re: error...

    mac wrote:
    hi,
    im new to php.can anybody please tell waht tis error is....
    >
    Notice: Undefined index: empname in d:\instantrails \www\test\new
    \formsubmit.php on line 14
    >
    >
    thanx
    mac
    >
    You didn't show any code, so it's impossible to tell you exactly.
    However, it means you are trying to access an element of an array which
    doesn't exist, i.e. you are trying to get the value of
    $my_array['empname'], but never set it.

    You can check to see if a value has been set with isset().

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • mac

      #3
      Re: error...

      On Sep 9, 4:04 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
      mac wrote:
      hi,
          im new to php.can anybody please tell waht tis error is....
      >
      Notice: Undefined index: empname in d:\instantrails \www\test\new
      \formsubmit.php on line 14
      >
      thanx
      mac
      >
      You didn't show any code, so it's impossible to tell you exactly.
      However, it means you are trying to access an element of an array which
      doesn't exist, i.e. you are trying to get the value of
      $my_array['empname'], but never set it.
      >
      You can check to see if a value has been set with isset().
      >
      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstuck...@attgl obal.net
      =============== ===
      hi,
      this is some code...


      <?php
      include("conn.p hp");
      $mode=$_REQUEST["mode"];
      if($mode=="add" ) {
      $empname=$_REQU EST["empname"];
      $age=$_REQUEST["age"];
      $designation=$_ REQUEST["designatio n"];
      $salary=$_REQUE ST["salary"];
      $state=$_REQUES T["state"];
      $city=$_REQUEST["city"];

      $sql="insert into
      emp(empname,age ,designation,sa lary,state,city )
      values('$empnam e','$age','$des ignation','$sal ary','$state',' $city')";
      $result=mysql_q uery($sql,$conn ection) or
      die(mysql_error ());




      header("locatio n: index.php");

      --------------------------
      ------------------

      Comment

      • Geoff Berrow

        #4
        Re: error...

        Message-ID:
        <b3d953bf-dc26-4849-b5db-9e1d1d9dab67@z1 1g2000prl.googl egroups.comfrom
        mac contained the following:
        include("conn.p hp");
        $mode=$_REQUEST["mode"];
        if($mode=="add" ) {
        $empname=$_REQU EST["empname"];
        $age=$_REQUEST["age"];
        $designation=$_ REQUEST["designatio n"];
        $salary=$_REQUE ST["salary"];
        $state=$_REQUES T["state"];
        $city=$_REQUEST["city"];
        >
        $sql="insert into
        >emp(empname,ag e,designation,s alary,state,cit y)
        >values('$empna me','$age','$de signation','$sa lary','$state', '$city')";
        $result=mysql_q uery($sql,$conn ection) or
        >die(mysql_erro r());
        The notice may be the least of your problems.

        See http://www.tizag.com/mysqlTutorial/m...-injection.php
        --
        Geoff Berrow 011000100110110 0010000000110
        001101101011011 001000110111101 100111001011
        100110001101101 111001011100111 010101101011
        http://slipperyhill.co.uk - http://4theweb.co.uk

        Comment

        • Jerry Stuckle

          #5
          Re: error...

          mac wrote:
          On Sep 9, 4:04 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
          >mac wrote:
          >>hi,
          >> im new to php.can anybody please tell waht tis error is....
          >>Notice: Undefined index: empname in d:\instantrails \www\test\new
          >>\formsubmit.p hp on line 14
          >>thanx
          >>mac
          >You didn't show any code, so it's impossible to tell you exactly.
          >However, it means you are trying to access an element of an array which
          >doesn't exist, i.e. you are trying to get the value of
          >$my_array['empname'], but never set it.
          >>
          >You can check to see if a value has been set with isset().
          >>
          >--
          >============== ====
          >Remove the "x" from my email address
          >Jerry Stuckle
          >JDS Computer Training Corp.
          >jstuck...@attg lobal.net
          >============== ====
          >
          hi,
          this is some code...
          >
          >
          <?php
          include("conn.p hp");
          $mode=$_REQUEST["mode"];
          if($mode=="add" ) {
          $empname=$_REQU EST["empname"];
          $age=$_REQUEST["age"];
          $designation=$_ REQUEST["designatio n"];
          $salary=$_REQUE ST["salary"];
          $state=$_REQUES T["state"];
          $city=$_REQUEST["city"];
          >
          $sql="insert into
          emp(empname,age ,designation,sa lary,state,city )
          values('$empnam e','$age','$des ignation','$sal ary','$state',' $city')";
          $result=mysql_q uery($sql,$conn ection) or
          die(mysql_error ());
          >
          >
          >
          >
          header("locatio n: index.php");
          >
          --------------------------
          ------------------
          >
          It means that $_REQUEST['empname'] is not set. This should have
          probably come from a form posted to this page.

          Before attempting to use the value, you should check to see if it is
          set, with

          if (isset($_REQUES T['empname'])) { ...

          And also - you shouldn't be using $_REQUEST. Rather, use $_POST or
          $_GET, depending on whether the form method is GET or POST. $_REQUEST
          will check either, but will also check $_COOKIE - which will cause you
          problems if you ever set a cookie for empname. No, I'm sure you aren't
          planning to do so now - but what about six months from now? This just
          leaves another door open for a bug.

          And as Geoff said - study up on SQL injection. If you don't understand
          it and watch for it, a hacker can do almost anything he wants to your
          database - including wiping it out.

          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstucklex@attgl obal.net
          =============== ===

          Comment

          • mac

            #6
            Re: error...

            On Sep 9, 10:43 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
            mac wrote:
            On Sep 9, 4:04 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
            mac wrote:
            >hi,
            >    im new to php.can anybody please tell waht tis error is....
            >Notice: Undefined index: empname in d:\instantrails \www\test\new
            >\formsubmit.ph p on line 14
            >thanx
            >mac
            You didn't show any code, so it's impossible to tell you exactly.
            However, it means you are trying to access an element of an array which
            doesn't exist, i.e. you are trying to get the value of
            $my_array['empname'], but never set it.
            >
            You can check to see if a value has been set with isset().
            >
            --
            =============== ===
            Remove the "x" from my email address
            Jerry Stuckle
            JDS Computer Training Corp.
            jstuck...@attgl obal.net
            =============== ===
            >
            hi,
            this is some code...
            >
            <?php
                      include("conn.p hp");
                      $mode=$_REQUEST["mode"];
                      if($mode=="add" ) {
                        $empname=$_REQU EST["empname"];
                        $age=$_REQUEST["age"];
                        $designation=$_ REQUEST["designatio n"];
                        $salary=$_REQUE ST["salary"];
                        $state=$_REQUES T["state"];
                        $city=$_REQUEST["city"];
            >
                        $sql="insert into
            emp(empname,age ,designation,sa lary,state,city )
            values('$empnam e','$age','$des ignation','$sal ary','$state',' $city')";
                        $result=mysql_q uery($sql,$conn ection) or
            die(mysql_error ());
            >
                          header("locatio n: index.php");
            >
                          --------------------------
            ------------------
            >
            It means that $_REQUEST['empname'] is not set.  This should have
            probably come from a form posted to this page.
            >
            Before attempting to use the value, you should check to see if it is
            set, with
            >
               if (isset($_REQUES T['empname'])) { ...
            >
            And also - you shouldn't be using $_REQUEST.  Rather, use $_POST or
            $_GET, depending on whether the form method is GET or POST.  $_REQUEST
            will check either, but will also check $_COOKIE - which will cause you
            problems if you ever set a cookie for empname.  No, I'm sure you aren't
            planning to do so now - but what about six months from now?  This just
            leaves another door open for a bug.
            >
            And as Geoff said - study up on SQL injection.  If you don't understand
            it and watch for it, a hacker can do almost anything he wants to your
            database - including wiping it out.
            >
            --
            =============== ===
            Remove the "x" from my email address
            Jerry Stuckle
            JDS Computer Training Corp.
            jstuck...@attgl obal.net
            =============== ===- Hide quoted text -
            >
            - Show quoted text -
            hi,
            thnks a lot...the prblm got solved.
            mac

            Comment

            • mac

              #7
              Re: error...

              On Sep 9, 10:43 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
              mac wrote:
              On Sep 9, 4:04 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
              mac wrote:
              >hi,
              >    im new to php.can anybody please tell waht tis error is....
              >Notice: Undefined index: empname in d:\instantrails \www\test\new
              >\formsubmit.ph p on line 14
              >thanx
              >mac
              You didn't show any code, so it's impossible to tell you exactly.
              However, it means you are trying to access an element of an array which
              doesn't exist, i.e. you are trying to get the value of
              $my_array['empname'], but never set it.
              >
              You can check to see if a value has been set with isset().
              >
              --
              =============== ===
              Remove the "x" from my email address
              Jerry Stuckle
              JDS Computer Training Corp.
              jstuck...@attgl obal.net
              =============== ===
              >
              hi,
              this is some code...
              >
              <?php
                        include("conn.p hp");
                        $mode=$_REQUEST["mode"];
                        if($mode=="add" ) {
                          $empname=$_REQU EST["empname"];
                          $age=$_REQUEST["age"];
                          $designation=$_ REQUEST["designatio n"];
                          $salary=$_REQUE ST["salary"];
                          $state=$_REQUES T["state"];
                          $city=$_REQUEST["city"];
              >
                          $sql="insert into
              emp(empname,age ,designation,sa lary,state,city )
              values('$empnam e','$age','$des ignation','$sal ary','$state',' $city')";
                          $result=mysql_q uery($sql,$conn ection) or
              die(mysql_error ());
              >
                            header("locatio n: index.php");
              >
                            --------------------------
              ------------------
              >
              It means that $_REQUEST['empname'] is not set.  This should have
              probably come from a form posted to this page.
              >
              Before attempting to use the value, you should check to see if it is
              set, with
              >
                 if (isset($_REQUES T['empname'])) { ...
              >
              And also - you shouldn't be using $_REQUEST.  Rather, use $_POST or
              $_GET, depending on whether the form method is GET or POST.  $_REQUEST
              will check either, but will also check $_COOKIE - which will cause you
              problems if you ever set a cookie for empname.  No, I'm sure you aren't
              planning to do so now - but what about six months from now?  This just
              leaves another door open for a bug.
              >
              And as Geoff said - study up on SQL injection.  If you don't understand
              it and watch for it, a hacker can do almost anything he wants to your
              database - including wiping it out.
              >
              --
              =============== ===
              Remove the "x" from my email address
              Jerry Stuckle
              JDS Computer Training Corp.
              jstuck...@attgl obal.net
              =============== ===- Hide quoted text -
              >
              - Show quoted text -
              in my form i have 2 comboboxes viz state and city,,,,if i select
              state automatically only those cities shud wich come under that
              perticular state.. in city combobox... hw to do any idea abt html
              select tag?
              mac

              Comment

              • Curtis

                #8
                Re: error...

                mac wrote:
                On Sep 9, 10:43 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                >mac wrote:
                >>On Sep 9, 4:04 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                >>>mac wrote:
                >>>>hi,
                >>>> im new to php.can anybody please tell waht tis error is....
                >>>>Notice: Undefined index: empname in d:\instantrails \www\test\new
                >>>>\formsubmit .php on line 14
                >>>>thanx
                >>>>mac
                >>>You didn't show any code, so it's impossible to tell you exactly.
                >>>However, it means you are trying to access an element of an array which
                >>>doesn't exist, i.e. you are trying to get the value of
                >>>$my_array['empname'], but never set it.
                >>>You can check to see if a value has been set with isset().
                >>>>
                >>hi,
                >>this is some code...
                >><?php
                >> include("conn.p hp");
                >> $mode=$_REQUEST["mode"];
                >> if($mode=="add" ) {
                >> $empname=$_REQU EST["empname"];
                >> $age=$_REQUEST["age"];
                >> $designation=$_ REQUEST["designatio n"];
                >> $salary=$_REQUE ST["salary"];
                >> $state=$_REQUES T["state"];
                >> $city=$_REQUEST["city"];
                >> $sql="insert into
                >>emp(empname,a ge,designation, salary,state,ci ty)
                >>values('$empn ame','$age','$d esignation','$s alary','$state' ,'$city')";
                >> $result=mysql_q uery($sql,$conn ection) or
                >>die(mysql_err or());
                >> header("locatio n: index.php");
                >> --------------------------
                >>------------------
                >It means that $_REQUEST['empname'] is not set. This should have
                >probably come from a form posted to this page.
                >>
                >Before attempting to use the value, you should check to see if it is
                >set, with
                >>
                > if (isset($_REQUES T['empname'])) { ...
                >>
                >And also - you shouldn't be using $_REQUEST. Rather, use $_POST or
                >$_GET, depending on whether the form method is GET or POST. $_REQUEST
                >will check either, but will also check $_COOKIE - which will cause you
                >problems if you ever set a cookie for empname. No, I'm sure you aren't
                >planning to do so now - but what about six months from now? This just
                >leaves another door open for a bug.
                >>
                >And as Geoff said - study up on SQL injection. If you don't understand
                >it and watch for it, a hacker can do almost anything he wants to your
                >database - including wiping it out.
                >>
                >
                in my form i have 2 comboboxes viz state and city,,,,if i select
                state automatically only those cities shud wich come under that
                perticular state.. in city combobox... hw to do any idea abt html
                select tag?
                mac
                I believe you're looking for JavaScript help, in this case, not PHP.
                Try comp.lang.javas cript.

                --
                Curtis

                Comment

                Working...