PHP部分:
if (!empty($_GET['ID_personne'])) {
$id = checkInput($_GET['ID_personne']);
}
// ....................
if (!empty($_POST)) {
$CIN = checkInput($_POST['CIN']);
// ................
$statement = $db->prepare("UPDATE personnes
set
ID_personne =:cin,
Nom = :nom,
Prenom = :prenom,
Telephone = :telephone,
Mail = :mail,
Categorie=:categorie,
Type=:type
WHERE ID_personne = :id");
$statement->bindValue(':cin',$CIN);
$statement->bindValue(':nom',$nom);
$statement->bindValue(':prenom',$prenom);
$statement->bindValue(':telephone',$telephone);
$statement->bindValue(':categorie',$categorie);
$statement->bindValue(':mail',$mail);
$statement->bindValue(':type',$type);
$statement->bindValue(':id',$id);
$statement->execute();
header("Location: personnes.php");
}
HTML部分:
<!-- ............. -->
<form class="form" action="update_personnes.php" role="form"
method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="CIN">CIN:</label>
<input maxlength="8" minlength="8" type="text" class="form-
control" id="CIN" name="CIN" placeholder="CIN" value="<?php echo $CIN;?>">
<!-- ............... -->
NB:这些要点意味着有代码,但是对于解决我的错误没有用。
填写表单后,我想更新我的id
,然后单击“修改”,即使是其他列也无法使用:
如果我更改此行:
$statement->bindValue(':id',$id);
使用
$statement->bindValue(':id',$CIN);
其他列更改,而ID不变。
答案 0 :(得分:0)
我更改了HTML部分中的表单,并且可以正常工作:
res<-NULL
for (i in 1:length(min)){
res<-rbind(res,cbind(min[i],r1[abs(r1-min[i])<=0.5]))
}
res
# [,1] [,2]
#[1,] 3 3.5
#[2,] 6 5.5
#[3,] 11 11.5
答案 1 :(得分:-2)
使用此代码形成另一个文件
echo '<a class="btn btn-primary" href="update_personnes.php?ID_personne='.$personne['ID_personne'].'"><span class="glyphicon glyphicon-pencil"></span> Modifier</a>';