how are you getting the $tutor_id var?, in your script you are using "$action = $_GET["action"];" so you will need to define $tutor_id like $tutor_id = $_GET['tutor_id'], or just use $_GET['tutor_id'].
a form can only put variables in the POST array OR the GET array, and if your using hyperlinks to access this script then they will of course be GET vars. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 12 December 2003 09:38 To: [EMAIL PROTECTED] Subject: [PHP-DB] Need help!!! Hi.. Anyone can help me with this script???I kept getting error saying i did not define the variable "$tutor_id" and whenever I define it as $tutor_id = $_POST ['tutor_id'], I got error saying there was an "Undefined index"! What was exactly the problem?????? Need help desperately , greatly appreciate any suggestions/help/solutions given... ------------------------------------------------------------------------------- =======edit.php======== $dsn = "mysql://root:[EMAIL PROTECTED]/tb1"; $db = DB::connect ($dsn); if (DB::isError ($db)) die ($db->getMessage()); $action = $_GET["action"]; if($action == "delete") { $sql = mysql_query ("DELETE FROM tutor WHERE tutor_id='$tutor_id'"); } if($action == "edit") { $sql = mysql_query ("SELECT * FROM tutor WHERE tutor_id ='$tutor_id'");**************ERROR HERE!!***************** $row = mysql_fetch_array($sql); echo "<form name=\"edit_tutor\" method=\"post\" action=\"edit2.php\">"; echo "Tutor ID : ".$row['tutor_id']."<br>"; echo "<input type=\"hidden\" name=\"tutor_id\" value=\"".$row ['tutor_id']."\">"; echo "Name : <input name=\"tutor_name\" type=\"text\" value=\"".$row ['tutor_name']."\"><br>"; echo "Contact No : <input type=\"text\" name=\"tutor_contact\" value=\"".$row ['tutor_contact']."\"><br>"; echo "E-mail : <input type=\"text\" name=\"tutor_email\" value=\"".$row ['tutor_email']."\"><br>"; echo "Profile : <input type=\"text\" name=\"tutor_profile\" value=\"".$row ['tutor_profile']."\"><br>"; echo "<input type=\"submit\" name=\"Submit\" value=\"Update\">"; echo "</form>"; } ?> $result = $db->query($sql); if( DB::isError($result) ) { die ($result->getMessage()); } ------------------------------------------------------------------------------- Irin. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php