title: Using isset for correction?
body: <p>I'm new to PHP,I got error in my web page.It said:</p>
  
  <blockquote>
    <p>Notice: Undefined index: itemid in /home/tz005/public_html/COMP1687/edit.php on line 103</p>
  </blockquote>
  
  <p>Can I use isset to fix this problem? If yes, how to do so? Here is my script:</p>
  
  <pre><code>&lt;?php
  //include database connection
  include 'dbconnect.php';
  
  // if the form was submitted/posted, update the item
  if($_POST){
  
      //write query
      $sql = "UPDATE 
                  item_information 
              SET
                  itemtitle = ?, 
                  itemdescription = ?,
                  date = ?,
              WHERE 
                  itemid= ?";
  
      $stmt = $mysqli-&gt;prepare($sql);
  
      $stmt-&gt;bind_param(
          'sssi', 
          $_POST['itemtitle'], 
          $_POST['itemdescription'],
          $_POST['date'],
          $_POST['itemid']
      );
  
      // execute the update statement
      if($stmt-&gt;execute()){
          echo "Item was updated.";
  
          // close the prepared statement
          $stmt-&gt;close();
      }else{
          die("Unable to update.");
      }
  }
  
  $sql = "SELECT 
              itemid, itemtitle, itemdescription, date
          FROM 
              item_information
          WHERE 
              id = \"" . $mysqli-&gt;real_escape_string($_GET['itemid']) . "\"
          LIMIT 
              0,1";
  
  // execute the sql query
  $result = $mysqli-&gt;query( $sql );
  
  //get the result
  if ($result = $mysqli-&gt;query( $sql )) {
    if ($row = $result-&gt;fetch_assoc()) {
  
      // $row contains data
  
    }
  }
  
  //disconnect from database
  $result-&gt;free();
  $mysqli-&gt;close();
  ?&gt;
  </code></pre>