RE: Need help!!!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



you have the GET var in the hyperlink down as just 'id' not 'tutor_id', so change the hyperlink to 

echo "<td><a href=\"edit.php?tutor_id=".$row
["tutor_id"]."&action=edit\">Modify</a></td>";

or the the get var to $tutor_id = $_GET['id'];

-----Original Message-----
From: irinchiang@xxxxxxxxxxxxxxxxx [mailto:irinchiang@xxxxxxxxxxxxxxxxx]
Sent: 12 December 2003 10:02
To: Griffiths, Daniel
Cc: php-db@xxxxxxxxxxxxx
Subject: RE:  Need help!!!




Yes I'm using a hyperlink to access this page (see below)
echo "<td><a href=\"edit.php?id=".$row
["tutor_id"]."&action=edit\">Modify</a></td>";

and so I defined my variable "$tutor_id" as $tutor_id = $_GET['tutor_id'];
but i still got the error: "Undefined index: tutor_id 
in /usr/local/apache/htdocs/tutor/edit.php "....

WHat could be the problem?????;(


-------------------------------------------------------------------------------

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: irinchiang@xxxxxxxxxxxxxxxxx [mailto:irinchiang@xxxxxxxxxxxxxxxxx] 
Sent: 12 December 2003 09:38 
To: php-db@xxxxxxxxxxxxx 
Subject:  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:**********@localhost/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



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux