0

エラー表示

注意: 未定義の変数: 行 9 の E:\xampp\htdocs\Edit_Supp.php の行

注意: 未定義のインデックス: 12 行目の E:\xampp\htdocs\Edit_Supp.php の id サプライヤーが更新されました

コード: Edit_Supp_Form.php

<?php   
$SupplierID = $_GET['id'];
//Connect and select a database
mysql_connect ("localhost", "root", "");
mysql_select_db("supplierdetails");
//Run query
$result1 = mysql_query("SELECT * FROM suppliers WHERE SupplierID=$SupplierID"); 
while($row = mysql_fetch_array($result1)){
$SupplierID = $_GET['id'] = $row['SupplierID']; 
$SupplierID = $row['SupplierID']; 
$SupplierName = $row['SupplierName'];
$Currency = $row['Currency'];
$Location = $row['Location'];
$ContactNumber = $row['ContactNumber'];
$Email = $row['Email'];
  }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-    strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="" />
  <link rel="stylesheet" type="text/css" href="style.css" media="screen" />
 <form action="Edit_Supp.php" method="post">
 <br>
 </br>
 <input type="hidden" name="SupplierID" value="<?php echo $SupplierID;?>"/> 

Supplier Name: <input type="text" name="SupplierName" value="<?php echo $SupplierName ;?>" />
<br>
</br>
 Currency: <input type="text" name="Currency" value="<?php echo $Currency ;?>" />
 <br>
 </br>
 Location: <input type="text" name="Location" value="<?php echo $Location ;?>" />
 <br>
</br>
 Contact Number:<input type="text" name="ContactNumber" value="<?php echo $ContactNumber ;?>" /> 
<br>
</br>
Email:<input type="text" name="Email" value="<?php echo $Email ;?>" />
<br>
</br>
<input type="submit" value= "Edit Supplier Information"/>

 </form>
 </div>
 </body>
 </html> 

//このページの背後にあるコードである Edit_Sup のプラス コード:

<?php
 $con = mysql_connect("localhost", "root", "");  
    mysql_select_db("supplierdetails");   
      if (!$con)     
          {       
        die('Could not connect: ' . mysql_error());        
         }    
 //Run a query        
$SupplierID= $_POST['id'] = $row ["SupplierID"];
 $result1 = mysql_query ("SELECT * FROM suppliers WHERE SupplierID= '".$SupplierID."'") or die    (mysql_error());     
$row = mysql_fetch_array($result1); 
$SupplierID = $_GET['id'];
$SupplierID = $_POST['id'];
$SupplierName = $_POST['SupplierName'];
$Currency = $_POST['Currency'];
$Location = $_POST['Location'];
$ContactNumber = $_POST['ContactNumber'];
$Email = $_POST['Email'];  
$SupplierID = $row['SupplierID'];         
$query = "UPDATE suppliers SET SupplierName = '".$SupplierName."', Currency     = '".$Currency."', Location = '".$Location."', ContactNumber = '".$ContactNumber."', Email = '".$Email."' WHERE SupplierID = '".$SupplierID."'";     
$result1 = mysql_query($query);           
 //Check whether the query was successful or not    
 if($result1) 
{          
 echo "Supplier Updated"; 

 }
else 
{        
 die ("Query failed");    
  }    
 ?>
4

2 に答える 2

2

で参照$_POST['id']しましたEdit_sup.phpが、 という名前の入力フィールドが見つかりませんid。そして読み取りの9行目Edit_sup.php-

$SupplierID= $_POST['id'] = $row ["SupplierID"];

$rowその変数をどこから取得したかわかりません。

于 2012-04-20T10:41:45.327 に答える
0

あなたは を手に入れようとして$row['id']います、あなたが望むのは$_POST['SupplierID']

于 2012-04-20T10:43:00.957 に答える