2012-10-05 84 views
0

我懷疑如何在鏈接中獲取兩個值並將其傳遞給編輯函數。幫助請.......php鏈接參數

以下是代碼,

兩個我都想要ManufactureDate可以和產品代碼,傳遞給獲得[EDI],

<td > <a name="edit" href="productwarrantymaster.php?edi[]=<? echo $record['ProductCode']; echo $record['ManufactureDate'];?>">Edit</a></td> 

以下是代碼爲編輯功能,

if(!empty($_GET['edi'])) 
{ 
$prmaster =$_GET['edi']; 
$Manufactu =$_GET['edi']; 


$result=mysql_query("SELECT * FROM productwarranty where ProductCode ='".$prmaster."' and ManufactureDate ='".$Manufactu."'"); 
$myrow1 = mysql_num_rows($result);//mysql_fetch_array($retval); 

     if($myrow1==0) 
     { 
      ?> 
      <script type="text/javascript"> 
      alert("No Data Found!!"); 
      </script> 
      <? 
     } 
     else 
     { 
      $myrow = mysql_fetch_array($result); 

      $ProductCode = $myrow['ProductCode']; 
      $WarrantyPeriod = $myrow['WarrantyPeriod']; 
      $ProRataPeriod = $myrow['ProRataPeriod']; 
      $ManufactureDate = $myrow['ManufactureDate']; 
      $ApplicableFormDate = $myrow['ApplicableFormDate']; 
     } 
     $prmaster = NULL; 
} 

回答

0

試試這個代碼

<a name="edit" href="productwarrantymaster.php?ProductCode=<?=$record['ProductCode']?>&ManufactureDate=<?=$record['ManufactureDate'];?>">Edit</a> 

,改變喜歡這裏,

if(!empty($_GET['ProductCode'])) 
{ 
    $prmaster = $_GET['ProductCode']; 
    $Manufactu = $_GET['ManufactureDate']; 
+0

我該如何將此函數傳遞給edi函數? –

+1

替換這個代碼它應該工作 –

+1

像LearneR說的,替換代碼,它應該工作! – Chris

0

試試這個:

<td><a name="edit" href="productwarrantymaster.php?edi=1&prodCode=<?php echo $record['ProductCode'];?>&manuDate=<?php echo $record['ManufactureDate'];?>">Edit</a></td> 

這需要驗證!!!!!!!!

if(!empty($_GET['edi'])) 
{ 
    $prmaster =$_GET['prodCode']; 
    $Manufactu =$_GET['manuDate']; 


$result=mysql_query("SELECT * FROM productwarranty where ProductCode ='".$prmaster."' and ManufactureDate ='".$Manufactu."'"); 
$myrow1 = mysql_num_rows($result);//mysql_fetch_array($retval); 

     if($myrow1==0) 
     { 
      ?> 
      <script type="text/javascript"> 
      alert("No Data Found!!"); 
      </script> 
      <? 
     } 
     else 
     { 
      $myrow = mysql_fetch_array($result); 

      $ProductCode = $myrow['ProductCode']; 
      $WarrantyPeriod = $myrow['WarrantyPeriod']; 
      $ProRataPeriod = $myrow['ProRataPeriod']; 
      $ManufactureDate = $myrow['ManufactureDate']; 
      $ApplicableFormDate = $myrow['ApplicableFormDate']; 
     } 
     $prmaster = NULL; 
}