title: Notice:undefined variable
body: <p>Hope everyone is fine over there :)</p>
  
  <p>Actually I am getting the multiple errors of undefined variable but code seems perfectly alright. I am getting this problem again and again in my scripts and I am really fed up from it. It delays my work. </p>
  
  <p>Please check the code and send any solution please. 
  Any kind of help will be appreciated. Thanks in advance </p>
  
  <p>Here is my code for    <em>manage-learning-material.php</em></p>
  
  <pre><code>&lt;?php include("../includes/config.php"); ?&gt;
  &lt;?php
  
  if ($_SESSION["isteacher"])
  {
  
  $con=mysql_connect($dbserver,$dbusername,$dbpassword);
  if (!$con) { die('Could not connect: ' . mysql_error()); }
  
  mysql_select_db($dbname, $con);
  $courseid=$_GET["id"];
  $result = mysql_query("SELECT * FROM courses WHERE (id='".$courseid."')");
  
  
  while($row = mysql_fetch_array($result))
  {
     $id=$row['id'];
     $title = $row['title'];
     $des = $row['description'];
     $subjectid = $row['subjectsid'];
  }
  mysql_close($con);
  ?&gt;
  &lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Manage Learning Material&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h2 class="alt"&gt;COURSE VIEW &lt;/h2&gt;
  &lt;?php
  if (isset($_GET["status"]))
  {
  if($_GET["status"]==1)
  {
  ?&gt;
  &lt;div class="success"&gt;
  &lt;?php
  echo("&lt;strong&gt;Material has been added in Course Successfully!&lt;/strong&gt;");
  ?&gt;
  &lt;/div&gt;
  &lt;?php
  }
  
  if($_GET["status"]==2)
  {
  ?&gt;
  &lt;div class="success"&gt;
  &lt;?php
  echo("&lt;strong&gt;Learning Material has been Edited Successfully!&lt;/strong&gt;");
  ?&gt;
  &lt;/div&gt;
  &lt;?php
  }
  }
  ?&gt;
  &lt;form id="form" method="post" action="manage-learning-material-action.php"&gt;
   &lt;input type="hidden" value="&lt;?php echo $courseid; ?&gt;" name="id" /&gt;
   &lt;label&gt;Course Name:&lt;/label&gt;&lt;input type="text" name="title" id="title" class="text" value="&lt;?php    echo $title; ?&gt;" /&gt;&lt;br /&gt;&lt;br /&gt;
  &lt;label&gt;Choose Subject:&lt;/label&gt;
  &lt;?php
  
  $con=mysql_connect($dbserver,$dbusername,$dbpassword);
  if (!$con) { die('Could not connect: ' . mysql_error()); }
  
  mysql_select_db($dbname, $con);
  
  
  $result = mysql_query("SELECT * FROM subjects");
  
  echo "&lt;select name='subjectsid'&gt;\n";
  while($row = mysql_fetch_array($result))
  {
  echo "&lt;option value='".$row['id'] . "'";
  if ($subjectid==$row['id'])
  echo 'selected="selected"';
  echo " &gt;" . $row['subjectname'] . "&lt;/option&gt;\n";
  }
  echo "&lt;/select&gt;\n";
  mysql_close($con);
  ?&gt;
  &lt;br /&gt;&lt;br /&gt;
  &lt;label&gt;Description:&lt;/label&gt;&lt;br /&gt;&lt;textarea name="description" id="description"&gt;&lt;?php echo $des; ?  &gt;&lt;/textarea&gt;&lt;br /&gt; &lt;br /&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;?php include("../includes/footer.php"); ?&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  &lt;?php
   }
   else
   {
      header("Location: ".$fullpath."login/unauthorized.php");
  
   }
  ?&gt;
  </code></pre>
  
  <p><em>manage-learning-material-action.php</em></p>
  
  <pre><code>&lt;?php include("../includes/config.php");?&gt;
  &lt;?php
  $id=$_POST["id"];
  $title=$_POST["title"];
  $des=$_POST["description"];
  $subjectid=$_POST["subjectsid"];
  
  $con=mysql_connect($dbserver,$dbusername,$dbpassword);
  if (!$con) { die('Could not connect: ' . mysql_error()); }
  mysql_select_db("ombts", $con);
  $query=("UPDATE courses SET title='".$title."', description='".$des."', subjectsid='".$subjectid."'      WHERE (id='".$id."')");
  $result=mysql_query($query);
  if($result){
  echo header("Location:manage-courses.php?status=2");
  }
  mysql_close($con);
  ?&gt;
  </code></pre>
  
  <p>Error/warnings are:</p>
  
  <pre><code>  Notice: Undefined index: id in C:\xampp\htdocs\project\teacher\manage-learning-material.php on   line 11
  
  &lt;br /&gt;&lt;b&gt;Notice&lt;/b&gt;:  Undefined variable: title in &lt;b&gt;C:\xampp\htdocs\project\teacher\manage-learning-material.php&lt;/b&gt; on line &lt;b&gt;86&lt;/b&gt;&lt;br /&gt;
   &lt;b&gt;Notice&lt;/b&gt;:  Undefined variable: subjectid in &lt;b&gt;C:\xampp\htdocs\project\teacher\manage-  learning-material.php&lt;/b&gt; on line &lt;b&gt;102&lt;/b&gt;&lt;br /&gt;
  &gt;Literature7&lt;/option&gt;
  &lt;option value='3'&lt;br /&gt;
  &lt;b&gt;Notice&lt;/b&gt;:  Undefined variable: subjectid in &lt;b&gt;C:\xampp\htdocs\project\teacher\manage-learning-  material.php&lt;/b&gt; on line &lt;b&gt;102&lt;/b&gt;&lt;br /&gt;
  &gt;Management&lt;/option&gt;
  &lt;option value='7'&lt;br /&gt;
  &lt;b&gt;Notice&lt;/b&gt;:  Undefined variable: subjectid in &lt;b&gt;C:\xampp\htdocs\project\teacher\manage-learning-  material.php&lt;/b&gt; on line &lt;b&gt;102&lt;/b&gt;&lt;br /&gt;
  &gt;Marketing&lt;/option&gt;
  &lt;option value='5'&lt;br /&gt;
  &lt;b&gt;Notice&lt;/b&gt;:  Undefined variable: subjectid in &lt;b&gt;C:\xampp\htdocs\project\teacher\manage-learning-   material.php&lt;/b&gt; on line &lt;b&gt;102&lt;/b&gt;&lt;br /&gt;
   &gt;Science&lt;/option&gt;
  &lt;option value='6'&lt;br /&gt;
  &lt;b&gt;Notice&lt;/b&gt;:  Undefined variable: subjectid in &lt;b&gt;C:\xampp\htdocs\project\teacher\manage-learning-  material.php&lt;/b&gt; on line &lt;b&gt;102&lt;/b&gt;&lt;br /&gt;
  &gt;Science2&lt;/option&gt;
  &lt;option value='4'&lt;br /&gt;
  &lt;b&gt;Notice&lt;/b&gt;:  Undefined variable: subjectid in &lt;b&gt;C:\xampp\htdocs\project\teacher\manage-learning-  material.php&lt;/b&gt; on line &lt;b&gt;102&lt;/b&gt;&lt;br /&gt;
  
  &lt;b&gt;Notice&lt;/b&gt;:  Undefined variable: des in &lt;b&gt;C:\xampp\htdocs\project\teacher\manage-learning-   material.php&lt;/b&gt; on line &lt;b&gt;110&lt;/b&gt;&lt;br /&gt;
  </code></pre>