-2

*

我喜欢通过 PHP(使用 '?' AND '&')从 Mysql 中检索记录中的三个值,并使用 $_GET 方法将其发送到另一个表单

*`// 表单发送值 form1

$connection=mysql_connect("localhost", "root","");
 mysql_select_db("xxxxxx_Database",$connection);
 $v= mysql_query("Select * from patient_details order by P_id");
 while ($row = mysql_fetch_array($v))
{ 
 echo "<tr><td>".$row['P_id']."</td><td>".$row['P_name']."</td><td>".$row['P_age']."       </td><td>"."<a href=Editing_Patient_Detail.php>Edit</a>   </td><td><a href=Delete_Patient_Detail.php?P_id=".$row['P_id']."&P_name=".$row['P_name']."&P_age="."row['P_age']".">Delete</a>";
}
          mysql_close( $connection);


 // form recieving the get values


 $connection=mysql_connect("localhost", "root","");
           mysql_select_db("Aravind_Database",$connection);
           if ($_GET['P_id']!= '')
          {     
        $v= mysql_query(" Select * from patient_details order by P_id");

        while ($row = mysql_fetch_array($v))

    {   
      if ($row['P_id'] == $_GET['P_id'])
     {
                               ?>
              <input type="text" value='<?php $_GET['P_id']?>' /><br>
        <input type="text" width="145" value='<?php $_GET['P_name']?>' /><br>
        <input type="text" value    ='<?php $_GET['P_age']?>' /><br> <?php 
       break;
      }
        }
  }

// I am recieving only the P_id and P_name values, I can't recieve the P_age value     through //get "Sorry friends, while pasting on the website I typed it wrongly (P_age)"

            `           
4

2 回答 2

0

那是因为您发送 id 和名称:
[a href=Delete_Patient_Detail.php?P_id=".$row['P_id']."&P_name=".$row['P_name']."&x="。 "10".">删除[/a>";

要使其工作,您必须添加该参数:

[a href=Delete_Patient_Detail.php?P_id=".$row['P_id']."&P_name=".$row['P_name']."&P_age=".$row['P_age']."&x=" ."10".">删除[/a>";

于 2012-05-09T09:37:05.233 回答
0

你确定你发送了所有 3 个参数吗,看起来你只发送了 2 个

href=Delete_Patient_Detail.php?P_id=".$row['P_id']."&P_name=".$row['P_name']."&x="."10". 

你错过了发送P_age

&P_age=".$row['P_age']."
于 2012-05-09T09:38:21.427 回答