我遇到插入声明的问题。它应该在从指定行的表中单击链接时将一行数据从一个表传输到另一个表。
此时,插入另一个表的唯一字段是引用。
换句话说,我想从一个表中的一行中检索一个人的姓名和详细信息,该行对应一个唯一的参考号,并将其移动到该过程的下一个表中。
表Page.php
<td align="center"><a href="refertotriage.php?Reference=<? echo $rows['Reference']; ?>">Refer for Triage</a></td>
<td align="center"><a href="update.php?Reference=<? echo $rows['Reference']; ?>">Refer for IA</a></td>
Script.php - 操作页面
require_once('auth.php');
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="sysadmin"; // Mysql password
$db_name="Elite"; // Database name
$tbl_name="Instruction"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$Reference=$_REQUEST['Reference'];
$Forename=$_REQUEST['Forename'];
$surname=$_REQUEST['surname'];
$DOB=$_REQUEST['DOB'];
$Mobile=$_REQUEST['Mobile'];
$Home=$_REQUEST['Home'];
$Address=$_REQUEST['Address'];
$Postcode=$_REQUEST['Postcode1'];
$Email=$_REQUEST['Email'];
$Accident=$_REQUEST['Accident'];
$Details=$_REQUEST['Details'];
//semi colon removed
$sql="INSERT INTO
Triage
(
Reference,
Forename,
surname,
`D.O.B`,
`Mobile Number`,
`Home Number`,
Address,
Postcode1,
Email,
Accident,
Details
)
VALUES
(
'".$Reference."',
'".$Forename."',
'".$surname."',
'".$DOB."',
'".$Mobile."',
'".$Home."',
'".$Address."',
'".$Postcode1."',
'".$Email."',
'".$Accident."',
'".$Details."'
)";
$result=mysql_query($sql);
// echo "Successful";
// echo "<BR>";
// echo "<a href='list_records.php'>View result</a>";
// mysql_error()
echo $sql
?>