我有这个表格,它将动作发布到 test2.php。
<form action="test2.php" method="post" name="add">
<tr>
IC NUMBER:<input name="defIc" value="" type="varchar" size="20" maxlength="20">
NAME:<input name="defName" value="" type="varchar" size="60" maxlength="60">
<input name="reset" type="reset" value="RESET">
<input type="submit" name="add" value=" ADD GUARANTOR ">
</form>
这是我的 test2.php 编码。在这个 test2.php 中,我结合了添加过程来将数据存储在“被告”表中。在 test2.php 中,我还包括了另一种需要回叫“被告 IC”和“IC 号码”的表格。
<?php
if (isset($_POST['add'])) {
$defIc = addslashes($_POST['defIc']);
$defName = addslashes($_POST['defName']);
include 'dbconnect.php';
$query = "INSERT INTO defendant (defIc, defName) VALUES
('$defIc', '$defName')";
echo $result = mysql_query($query);
if ($result)
{
if (isset($result['defIc']))
$defIc = $result['defIc'];
else
$defIc = 0;
include 'dbconnect.php';
$query = "Select * from defendant where defIc = '".$defIc."'";
$result = mysql_query($query1) or die('SQL error');
$row = mysql_fetch_array($result);
?>
DEFENDANT IC:<input name="defIc" value="<?php echo $row['defIc']; ?>"
type="varchar" size="20" maxlength="20" />
DEFENDANT NAME:<input name="defName" value="<?php echo $row['defName']; ?>"
type="varchar" size="20" maxlength="20" />
"
<?php
}
else
echo 'Add failed';
}
?>
现在的问题是,当我尝试回调 test2.php 中的“defIc”时,它没有出现。