【发布时间】:2015-03-03 19:24:21
【问题描述】:
更新我的表格时,它工作正常。但唯一的问题是我似乎无法回显输入中的字段。 并显示错误,未定义的索引。我不明白,我什么都试过了。但它不会回显。
例如:
未定义索引:第 80 行 /Applications/XAMPP/xamppfiles/htdocs/finalproject/admin/records/activities_update.php 中的 fam_name
我在获取 ID 回显方面没有问题。但其他变量 fam_name 、 fam_add、nochild、aid 等等......我无法检索它。我希望你明白我想说什么
我尝试使用 $_POST 、 $_GET 和行,但不起作用 =\
需要帮助几天来试图解决这个问题。
<?php
if(isset($_GET['success']) === true && empty($_GET['success']) === true){
echo ' Your details have been updated';
} else {
if (empty($_POST) === false && empty($errors) === true) {
$fam_data = array(
'fam_name' => $_POST['fam_name'],
'fam_add' => $_POST['fam_add'],
'nochild' => $_POST['nochild'],
'aid' => $_POST['aid'],
'date_visited' => $_POST['date_visited'],
'visited_since' => $_POST['visited_since'],
);
edit_family($fam_data);
header('Location: rec_act1.php?success');
exit();
//exit();
} else if (empty($errors) === false) {
echo output_errors($errors);
}
?>
<div id="insert_form">
<form name="update" action = "" method ="post">
<table border = "0" align = "center">
<tr>
<th colspan = "2"> </th>
</tr>
<tr>
<td><input type = "hidden" name = "id" maxlength = "9" value="<?php echo $id = $_GET['id'];?>"></td> Editing: <?php echo $id = $_GET['id'];?>
</tr>
<tr>
<td>Family Name: </td>
<td><input type = "text" name = "fam_name" maxlength = "9" value="<?php echo $_POST['fam_name']; ?>"></td>
</tr>
<tr>
<td>No. Of Family: </td>
<td><input type = "text" name = "nochild" maxlength = "30" value="<?php echo $row['nochild'];?>"></td>
</tr>
<tr>
<td>Family Address: </td>
<td><input type = "text" name = "fam_add" maxlength = "30" value="<?php echo $row['fam_add'];?>"></td>
</tr>
<tr>
<td>Types of Aid received: </td>
<td><input type = "float" name = "aid" step = 'any' min = 1 max = 99999999 value="<?php echo $row['aid'];?>"></td>
</tr>
<tr>
<td>Date Visited</td>
<td><input type = "date" name = "date_visited" value="<?php echo $row['date_visited'];?>"></td>
</tr>
<tr>
<td>Visited Since </td>
<td><input type = "date" name = "visited_since" value="<?php echo $row['visited_since'];?>"></td>
</tr>
<td><input type ="submit" name = "submit" value = "Update"></td></table>
</form></div><? } ?>
【问题讨论】:
标签: php echo undefined-index