SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Notice: Undefined index: keyresultdescr

    Hi All

    Can somebody help me on this...I got this error on my pages.But they are working but I dont know how to solve this...

    Notice: Undefined index: keyresultdescr in C:\Program Files\Business Objects\ThirdParties\apache\htdocs\wmis\search_keyresult.php on line 39

    Here is my code:
    --------------------------
    PHP Code:
    <?php $keyresult=0;?>
    <?php 
    //To re-uploading//////////////////////////

        //open connection to the database
        
    require_once('inc_conn.php');
        
    $sql="SELECT * FROM users 
        where ugroup = 'A'
        AND username= '"
    .$_SESSION['svusername']."'";
        
    //execute sql statements
        
    $rsusers4 mysql_query($sql$connwmis) or die(mysql_error());
        
    $rows_rsusers4 mysql_fetch_assoc($rsusers4);
        
    $num_rows4 mysql_num_rows($rsusers4);
    ?>
    <?php
    $detailplanid
    =0;
    $sql="SELECT userdetailplan.username,userdetailplan.detailplanid FROM userdetailplan,detailplan 
    where userdetailplan.username= '"
    .$_SESSION['svusername']."'
    AND userdetailplan.detailplanid = detailplan.detailplanid 
    AND userdetailplan.detailplanid = '"
    .$detailplanid."'";
        
    //execute sql statements
        
    $rsusername mysql_query($sql$connwmis) or die(mysql_error());
        
    $rows_rsusername mysql_fetch_assoc($rsusername);
        
    $num_rows2 mysql_num_rows($rsusername);
     
    ?>
        <?php
        
    //connect to MySQL server and imgp
        
    require_once('inc_conn.php');
        
    //execute sql
        
    $sql="select * from keyresult";
        
    //execute sql statements
        
    $rskeyresult mysql_query($sql$connwmis) or die(mysql_error());
        
    //retrieve one row of records
        
    $rows_rskeyresult mysql_fetch_array($rskeyresult);
        
    ?>
        <?php

    //open connection to the database
    require_once('inc_conn.php');
    if(
    $_REQUEST['keyresultdescr']){
    $keyresult $_REQUEST['keyresultdescr'];
    $sql="SELECT     
        detailplan.detailplanid,
        detailplan.detailplandescr,    
        keyresult.keyresultdescr,
        objective.objectivedescr,
        keyoutput.keyoutputdescr,
        keyoutput.keyoutputid, 
        keyoutput.budget,
        keyoutput.targetdate,
        keyoutput.date,
        keyoutput.status,
        role.roledescr    
        FROM detailplan, keyoutput,objective,keyresult,role
        WHERE detailplan.objectiveid = objective.objectiveid
        AND keyresult.keyresultid = detailplan.keyresultid
        AND role.roledescr = detailplan.roledescr
        AND keyoutput.detailplanid = detailplan.detailplanid 
        AND keyresult.keyresultdescr = '"
    .$keyresult."'    
        ORDER BY keyresult.keyresultdescr,objective.objectivedescr "
    ;
            
    //execute sql statements
        
    $rswork mysql_query($sql$connwmis) or die(mysql_error());
        
    //retrieve one row of records
        
    $rows_rswork mysql_fetch_array($rswork);
        
    //determine the number of records in recordset
        
    $num_rows mysql_num_rows($rswork);
    }
    ?>
    <?php 
    include('inc_top.php'); ?>    
        
    <h2>Personal Work Plan - Financial year 2006/07</h2>    
        
    <table width="50%" border="0" cellspacing="0" cellpadding="0">
    <form>    
    <tr>
    <td class="copy"><b>Key Result Area:</b></td>
    <td class="copy"><select name="keyresultdescr" OnChange="location.href=('search_keyresult.php?keyresultdescr='+this.options[selectedIndex].value)">
    <option value="">[Choose Key Result Area]</option>
    <?php do { ?>          
     <option value='<?php echo $rows_rskeyresult['keyresultdescr']; ?>'><?php echo $rows_rskeyresult['keyresultdescr']; ?></option>
     <?php } while ($rows_rskeyresult mysql_fetch_array($rskeyresult)); ?>    
    </select>
    </td>
    </tr>
    </form>
    </table>    
    <br><br>
    <?php if($keyresult == "") {
    echo 
    "";
    } else {
    ?>    
    <?php if($num_rows != 0) {?>
    <table width="100%" border="1" cellspacing="2" cellpadding="3">
    <tr>
       <td class="copy" width="6%"><b>Key Result Area</b></td>
        <td class="copy" width="24%"><b>Objective</b></td>
        <td class="copy" width="10%"><b>Responsible Manager</b></td>
        <td class="copy" width="40%"><b>Key Output</b></td>
        <td class="copy" width="6%"><b>Target Date</b></td>
        <td class="copy" width="10%"><b>Available Budget</b></td>
        <td class="copy" width="14%"><b>Status</b></td>        
    </tr>
    <?php do{ ?>
    <tr>
    <td class="copy"><b><?php echo $rows_rswork['keyresultdescr'];?></b></td>
    <td><b><?php echo "<a href='viewworkplan.php?detailplanid=".$rows_rswork['detailplanid']."' class='copy' title='Click here to download the Detailplan' style='text-decoration:none;'>".$rows_rswork['objectivedescr']."</a>";?></b>
    </td>
    <td class="copy"><?php echo $rows_rswork['roledescr'];?></td>
    <td class="copy"><?php echo $rows_rswork['keyoutputdescr'];?>
    </td>                
    <td class="copy" width="10%"><?php echo $rows_rswork['targetdate'];?></td>    
    <td class="copy">R<?php echo $rows_rswork['budget'];?></td>
    <td class="copy"><?php echo $rows_rswork['status'];?></td>
    </tr>
    <tr>
    <td colspan="7" class="copy">
    <?php
    //open connection to the database
    require_once('inc_conn.php');
    $key $rows_rswork['keyoutputid'];    
    // prepare query
    $sql="SELECT remark.keyoutputid,remark.remarkid,remark.remarkdescr,remark.date
     from remark,keyoutput
     where remark.keyoutputid = keyoutput.keyoutputid
         AND  keyoutput.keyoutputid = '"
    .$key."' order by remark.date DESC";
    $rsworkr mysql_query($sql$connwmis) or die(mysql_error());
    //retrieve one row of records
    $rows_rsworkr mysql_fetch_array($rsworkr);
    //determine the number of records in recordset
    $num_rows mysql_num_rows($rsworkr);    
     
    ?>
    <?php 
    if($num_rows != 0) {?>
    <table width="500" cellpadding="3" cellspacing="0" border="1">
    <tr>
    <td class="copy"><strong>Date</strong></td>
    <td class="copy"><strong>Remark/Progess Detail</strong></td>
    </tr>
    </tr>
    <?php do{ ?>
    <tr>
    <td class="copy"><?php echo $rows_rsworkr ['date'];?>    </td>
    <td class="copy">
    <?php echo $rows_rsworkr ['remarkdescr'];?>
    <?php 
    } while($rows_rsworkr mysql_fetch_array($rsworkr)); ?>    
    </td>
     </tr>
    </table>
     <?php } else {
    echo 
    "";
     }
    ?>
    </td>
    </tr>
            
    <?php } while($rows_rswork mysql_fetch_array($rswork)); ?>
    <tr>
    <td colspan="7" style="border-bottom:0px;border-left:0px;border-right:0px; "><input name="back" type="submit" value="       Back        " onclick="javascript: history.go(-1)">
    </tr>
    </table>    
    <?php } else {
    echo 
    "The complete <b>Detail Plan</b> have not been captured yet.";
    }
    }
    ?>        
    </td>
    <?php include('inc_bottom.php'); ?>
    --------------------------

    Thank you ???
    Last edited by sweatje; Aug 28, 2006 at 06:00. Reason: use PHP tags

  2. #2
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    change
    if($_REQUEST['keyresultdescr']){

    to
    if(array_key_exists('keyresultdescr', $_REQUEST) &&
    $_REQUEST['keyresultdescr']){
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you very much Sweatje
    Its all working now.
    Thankx a million

  4. #4
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sweatje
    change
    if($_REQUEST['keyresultdescr']){

    to
    if(array_key_exists('keyresultdescr', $_REQUEST) &&
    $_REQUEST['keyresultdescr']){
    Im still getting this problem again in different page though.
    Notice: Undefined index: keyresultid in C:\Program Files\Business Objects\ThirdParties\apache\htdocs\wmis\adddetailplanS_M.php on line 100

    Here is my code:
    -----------------------------------------
    <?php //To re-uploading//////////////////////////
    //open connection to the database
    require_once('inc_conn.php');
    $sql="SELECT * FROM users
    where ugroup = 'A'
    AND username= '".$_SESSION['svusername']."'";
    //execute sql statements
    $rsusers4 = mysql_query($sql, $connwmis) or die(mysql_error());
    $rows_rsusers4 = mysql_fetch_assoc($rsusers4);
    $num_rows4 = mysql_num_rows($rsusers4);
    ?>
    <?php
    $detailplanid=0;
    $sql="SELECT userdetailplan.username,userdetailplan.detailplanid FROM userdetailplan,detailplan
    where userdetailplan.username= '".$_SESSION['svusername']."'
    AND userdetailplan.detailplanid = detailplan.detailplanid
    AND userdetailplan.detailplanid = '".$detailplanid."'";
    //execute sql statements
    $rsusername = mysql_query($sql, $connwmis) or die(mysql_error());
    $rows_rsusername = mysql_fetch_assoc($rsusername);
    $num_rows2 = mysql_num_rows($rsusername);
    ////////////////////////////////To re-uploading ?>
    <?php
    $keyresultid = $_GET["keyresultid"];
    //open connection to the database
    require_once('inc_conn.php');
    $sql="SELECT keyresultid,keyresultdescr FROM keyresult where keyresultid= '".$keyresultid."'";
    //execute sql statements
    $rskeyresultid = mysql_query($sql, $connwmis) or die(mysql_error());
    //retrieve one row of records
    $rows_keyresultid = mysql_fetch_assoc($rskeyresultid);
    ?>
    <?php
    //open connection to the database
    require_once('inc_conn.php');
    // prepare query
    $sql="SELECT * FROM keyresult";
    //execute sql statements
    $rskeyresult = mysql_query($sql, $connwmis) or die(mysql_error());
    //retrieve one row of records
    $rows_rskeyresult = mysql_fetch_array($rskeyresult);
    //determine the number of records in recordset
    $num_rows = mysql_num_rows($rskeyresult);
    ?>
    <?php
    //open connection to the database
    require_once('inc_conn.php');
    // prepare query
    $sql="SELECT objective.keyresultid,
    objective.objectivedescr,
    keyresult.keyresultid
    FROM objective, keyresult
    WHERE objective.keyresultid = keyresult.keyresultid
    AND keyresult.keyresultid = '".$keyresultid."'";
    //execute sql statements
    $rsobjective = mysql_query($sql, $connwmis) or die(mysql_error());
    //retrieve one row of records
    $rows_rsobjective = mysql_fetch_array($rsobjective);
    //determine the number of records in recordset
    $num_rows = mysql_num_rows($rsobjective);
    ?>
    <?php /////drop dow lists
    if(array_key_exists('keyresultid', $_REQUEST) &&
    $_REQUEST['keyresultid']){
    $keyresultid = $_REQUEST["keyresultid"];
    //open connection to the database
    require_once('inc_conn.php');
    // prepare query
    $sql="SELECT objective.keyresultid,
    objective.objectivedescr,
    keyresult.keyresultid
    FROM objective, keyresult
    WHERE objective.keyresultid = keyresult.keyresultid
    AND keyresult.keyresultid = '".$keyresultid."'";
    //execute sql statements
    $rsobjectives = mysql_query($sql, $connwmis) or die(mysql_error());
    //retrieve one row of records
    $rows_rsobjectives = mysql_fetch_array($rsobjectives);
    //determine the number of records in recordset
    $num_rows = mysql_num_rows($rsobjectives);
    }////end drop down
    ?>
    <?php
    //open connection to the database
    require_once('inc_conn.php');
    // prepare query
    $sql="SELECT * FROM role;";
    //execute sql statements
    $rsrole = mysql_query($sql, $connwmis) or die(mysql_error());
    //retrieve one row of records
    $rows_rsrole = mysql_fetch_array($rsrole);
    //determine the number of records in recordset
    $num_rows = mysql_num_rows($rsrole);
    ?>
    <?php if (isset($_POST["btnsubmit"])){
    //Grab Form variables
    //$detailplan = $_POST['svdetailplanid'];
    $detailplandescr = $_POST['detailplandescr'];
    $objectiveid = $_POST["objectivedescr"];
    $keyresultid = $_POST["keyresultid"];
    $fileName = $_FILES['userfile']['name'];
    $tmpName = $_FILES['userfile']['tmp_name'];
    $fileSize = $_FILES['userfile']['size'];
    $fileType = $_FILES['userfile']['type'];
    //$roledescr = $_POST["myList"];
    $date=date("y-m-d");
    //open connection
    require_once('inc_conn.php');
    // prepare query
    $funcsql="SELECT keyresultid FROM keyresult WHERE keyresultdescr = '".$keyresultid."'";
    //execute sql statements
    $rskeyresultid = mysql_query($funcsql, $connwmis) or die(mysql_error());
    //retrieve one row of records
    $rows_rskeyresultid = mysql_fetch_array($rskeyresultid);
    $keyresultid = $rows_rskeyresultid['keyresultid'];
    $funcsql="SELECT objectiveid FROM objective WHERE objectivedescr = '".$objectiveid."'";
    //execute sql statements
    $rsobjectiveid = mysql_query($funcsql, $connwmis) or die(mysql_error());
    //retrieve one row of records
    $rows_rsobjectiveid = mysql_fetch_array($rsobjectiveid);
    $objectiveid = $rows_rsobjectiveid['objectiveid'];

    // you can change this to any directory you want
    // as long as php can write to it
    $uploadDir = '//localhost/htdocs/wmis/detailplan/';
    // the files will be saved in filePath
    $filePath = $uploadDir . $fileName;
    // move the files to the specified directory
    // if the upload directory is not writable or
    // something else went wrong $result will be false
    $result = move_uploaded_file($tmpName, $filePath);
    if (!$result) {
    echo "Error uploading file";
    exit;
    }
    if(!get_magic_quotes_gpc())
    {
    $fileName = addslashes($fileName);
    $filePath = addslashes($filePath);
    }
    //Insert into the database
    $insertSQL = "INSERT INTO detailplan(detailplandescr,keyresultid,objectiveid,roledescr,name,Size, type, path,date) VALUES ('$detailplandescr','".$_GET["keyresultid"]."','$objectiveid','$roledescr','$fileName', '$fileSize', '$fileType', '$filePath','$date')";
    //Execute the insert statement
    $execute = mysql_query($insertSQL, $connwmis) or die(mysql_error());
    //Redirect to the Policies page
    if($execute){
    mysql_close($connwmis);
    header("Location: addkeyoutput.php");
    }
    }
    ?>
    <?php
    function getUserrole($role){
    //open connection to the database
    require_once('inc_conn.php');
    // prepare query
    $funcsql="SELECT roledescr FROM role WHERE roledescr = '".$role."'";
    //execute sql statements
    $rsuserrole = mysql_query($funcsql, $connwmis) or die(mysql_error());
    //retrieve one row of records
    $rows_rsuserrole = mysql_fetch_array($rsuserrole);
    $number = $rows_rsuserrole['roledescr'];
    mysql_free_result($rsuserrole);
    return $number;
    }
    ?>
    <?php
    function getkeyresult($name){
    //open connection to the database
    require_once('inc_conn.php');
    // prepare query
    $funcsql="SELECT keyresultid FROM keyresult WHERE keyresultdescr = '".$name."'";
    //execute sql statements
    $rskeyresultid = mysql_query($funcsql, $connwmis) or die(mysql_error());
    //retrieve one row of records
    $rows_rskeyresultid = mysql_fetch_array($rskeyresultid);

    $number = $rows_rskeyresultid['keyresultid'];
    mysql_free_result($rskeyresultid);
    return $number;
    }
    ?>
    <?php
    function getobjective($name){
    //open connection to the database
    require_once('inc_conn.php');
    // prepare query
    $funcsql="SELECT objectiveid FROM objective WHERE objectivedescr = '".$name."'";
    //execute sql statements
    $rsobjectiveid = mysql_query($funcsql, $connwmis) or die(mysql_error());
    //retrieve one row of records
    $rows_rsobjectiveid = mysql_fetch_array($rsobjectiveid);

    $number = $rows_rsobjectiveid['objectiveid'];
    mysql_free_result($rsobjectiveid);
    return $number;
    }
    ?>
    <?php include('inc_top.php'); ?>
    <?php include('inc_java.php'); ?>
    <h2>Add Detailplan</h2>
    <?php if(($num_rows4 > 0) || ($num_rows2 > 0)){?>
    <table border="0" cellspacing="0" cellpadding="2">
    <form name="detailplan" method="post" action="" enctype="multipart/form-data">
    <tr>
    <td class="copy"><b>Key Result/b></td>
    <td class="copy"><select name="keyresultdescr" OnChange="location.href=('adddetailplanS_M.php?keyresultid='+this.options[selectedIndex].value)">
    <?php if($_SESSION['svkeyresultid'] != $_GET['keyresultid']){?>
    <option value=''><?php echo $rows_keyresultid['keyresultdescr']?></option>
    <?php } else {?>
    <option value="">[Choose Key Result Area]</option>
    <?php }?>
    <?php do { ?>
    <option value='<?php echo $rows_rskeyresult['keyresultid']; ?>'><?php echo $rows_rskeyresult['keyresultdescr']; ?></option>
    <?php } while ($rows_rskeyresult = mysql_fetch_array($rskeyresult)); ?>
    </select>
    </td>
    </tr>
    <tr>
    <td class="copy"><b>Objectives/b></td>
    <td>
    <select name="objectivedescr">
    <option value="">[Choose Objective]</option>
    <?php do { ?>
    <option><?php echo $rows_rsobjective['objectivedescr']; ?></option>
    <?php } while ($rows_rsobjective = mysql_fetch_array($rsobjective)); ?>
    </select>
    </td>
    </tr>
    <tr>
    <td class="copy"><b>Detail Plan/b></td>
    <td><input type="hidden" name="MAX_FILE_SIZE" value="2000000" /><input name="userfile" type="file"></td>
    </tr>
    <tr>
    <td class="copy"><b>Description/b></td>
    <td><textarea type="text" name="detailplandescr" cols="40" rows="5"></textarea></td>
    </tr>
    <!--<tr>
    <td class="copy"><b>Role/b></td>
    <td><select name="role" size="1" id="myList" onchange="favBrowser()">
    <option value="">[Choose User Role]</option>
    <?php do { ?>
    <option value=""><?php echo $rows_rsrole['roledescr']; ?></option>
    <?php } while ($rows_rsrole = mysql_fetch_array($rsrole)); ?>
    </select> <input name="myList" type="text" id="favorite" style="background-color:#CCCCCC;color:#cccccc;border:1px solid #cccccc;">
    </td>
    </tr>-->
    <tr>
    <td>&nbsp;</td>
    <td><input name="btnsubmit" type="submit" id="btnsubmit" value="Submit" class="button"></td>
    </tr>
    </form>
    </table>
    <?php } else {?>
    <b><?php echo $_SESSION['svname'];?></b>, you are Unauthorised to use this page.
    <br>
    <table border="0" cellspacing="0" cellpadding="2">
    <tr>
    <td><input name="back" type="submit" value=" Back " onclick="javascript: history.go(-1)"></td>
    <td></td>
    </tr>
    </table>
    <?php }?>
    </td>
    <?php include('inc_bottom.php'); ?>
    -----------------------------------------

  5. #5
    SitePoint Enthusiast brettuk02's Avatar
    Join Date
    Aug 2003
    Location
    Hereford, UK
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Possibly a typo in your form

    PHP Code:
    <select name="keyresultdescr" OnChange="location.href=('adddetailplanS_M.php?keyresultid='+this.options[selectedIndex].value)"
    shouldn't it be "keyresultid" ?

    PHP Code:
    $detailplandescr $_POST['detailplandescr'];
    $objectiveid $_POST["objectivedescr"];
    $keyresultid $_POST["keyresultid"];
    $fileName $_FILES['userfile']['name'];
    $tmpName $_FILES['userfile']['tmp_name'];
    $fileSize $_FILES['userfile']['size'];
    $fileType $_FILES['userfile']['type'];
    //$roledescr = $_POST["myList"];
    $date=date("y-m-d");
    //open connection
    require_once('inc_conn.php');
    // prepare query
    $funcsql="SELECT keyresultid FROM keyresult WHERE keyresultdescr = '".$keyresultid."'"
    seems keyresultdescr and id mean the same thing, so it seems to me you're trying to use the wrong name...
    Brett Jenkins - Freelance PHP/mySQL Coder
    www.brettjenkins.co.uk


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •