0

我怀疑如何在链接中获取两个值并将其传递给编辑函数。请帮助......

以下是代码,

我希望将制造品和产品代码都传递给 get[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;
}
4

2 回答 2

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'];
于 2012-10-05T10:25:17.463 回答
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;
}
于 2012-10-05T10:26:10.840 回答