notice:undefined variable

qypefera

New Member
Hope everyine is fine over thre :)actually iam getting the multiple errors of undefined variable but code seems perfectlly alrite.. iam getting this problem again and again in my scripts and im really fed up from it..it delays my wrok. please check the code and mend any solutionplease. any kind of help willbe appreciated. thnx in advance ^-^here is my code for manage-learning-material.php\[code\]<?php include("../includes/config.php"); ?><?phpif ($_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);?><!DOCTYPE HTML><html><head><title>Manage Learning Material</title></head><body><h2 class="alt">COURSE VIEW </h2><?phpif (isset($_GET["status"])){if($_GET["status"]==1){?><div class="success"><?phpecho("<strong>Material has been added in Course Successfully!</strong>");?></div><?php}if($_GET["status"]==2){?><div class="success"><?phpecho("<strong>Learning Material has been Edited Successfully!</strong>");?></div><?php}}?><form id="form" method="post" action="manage-learning-material-action.php"> <input type="hidden" value="http://stackoverflow.com/questions/12706670/<?php echo $courseid; ?>" name="id" /> <label>Course Name:</label><input type="text" name="title" id="title" class="text" value="http://stackoverflow.com/questions/12706670/<?php echo $title; ?>" /><br /><br /><label>Choose Subject:</label><?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 "<select name='subjectsid'>\n";while($row = mysql_fetch_array($result)){echo "<option value='".$row['id'] . "'";if ($subjectid==$row['id'])echo 'selected="selected"';echo " >" . $row['subjectname'] . "</option>\n";}echo "</select>\n";mysql_close($con);?><br /><br /><label>Description:</label><br /><textarea name="description" id="description"><?php echo $des; ? ></textarea><br /> <br /></form></div></div><?php include("../includes/footer.php"); ?></div></body></html><?php } else { header("Location: ".$fullpath."login/unauthorized.php"); }?> manage-learning-material-action.ph<?php include("../includes/config.php");?><?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);?>\[/code\]error/warnings are:\[code\] Notice: Undefined index: id in C:\xampp\htdocs\project\teacher\manage-learning-material.php on line 11<br /><b>Notice</b>: Undefined variable: title in <b>C:\xampp\htdocs\project\teacher\manage-learning-material.php</b> on line <b>86</b><br /> <b>Notice</b>: Undefined variable: subjectid in <b>C:\xampp\htdocs\project\teacher\manage- learning-material.php</b> on line <b>102</b><br />>Literature7</option><option value='http://stackoverflow.com/questions/12706670/3'<br /><b>Notice</b>: Undefined variable: subjectid in <b>C:\xampp\htdocs\project\teacher\manage-learning- material.php</b> on line <b>102</b><br />>Management</option><option value='http://stackoverflow.com/questions/12706670/7'<br /><b>Notice</b>: Undefined variable: subjectid in <b>C:\xampp\htdocs\project\teacher\manage-learning- material.php</b> on line <b>102</b><br />>Marketing</option><option value='http://stackoverflow.com/questions/12706670/5'<br /><b>Notice</b>: Undefined variable: subjectid in <b>C:\xampp\htdocs\project\teacher\manage-learning- material.php</b> on line <b>102</b><br /> >Science</option><option value='http://stackoverflow.com/questions/12706670/6'<br /><b>Notice</b>: Undefined variable: subjectid in <b>C:\xampp\htdocs\project\teacher\manage-learning- material.php</b> on line <b>102</b><br />>Science2</option><option value='http://stackoverflow.com/questions/12706670/4'<br /><b>Notice</b>: Undefined variable: subjectid in <b>C:\xampp\htdocs\project\teacher\manage-learning- material.php</b> on line <b>102</b><br /><b>Notice</b>: Undefined variable: des in <b>C:\xampp\htdocs\project\teacher\manage-learning- material.php</b> on line <b>110</b><br />\[/code\]
 
Top