php修改表单isuue错误

时间:2014-02-27 15:13:48

标签: php html

( ! ) Notice: Undefined index: Nom in C:\wamp\www\Rendu\Modifier.php on line 2

我在modifier.php上有这个错误,我不知道如何解决这个问题 在validModif.php

上也一样
( ! ) Notice: Undefined index: Nom in C:\wamp\www\Rendu\ValidModif.php on line 6
( ! ) Notice: Undefined index: Prenom in C:\wamp\www\Rendu\ValidModif.php on line 7
( ! ) Notice: Undefined index: Sexe in C:\wamp\www\Rendu\ValidModif.php on line 8

这是我的代码 我也添加和删除,他们工作正常所以数据库没有问题,我想我在这里遗漏了一些东西谢谢你提前

Modifier.php

<?php
$NomRecupere=$_GET['Nom'];

include("Connexion.php");
seConnecter();



$requete="select * from Personne where Nom='$NomRecupere'";
$resultat = mysql_query($requete);
while($ligne=mysql_fetch_array($resultat)){


?>
<html>
<head>
<link type="text/css" rel="stylesheet" href="2A5-Rendu AhmedelFadhelAchour CSS.css" />
<script language="javascript" type="text/javascript" src="2A5-Rendu AhmedelFadhelAchour                JS.js">


</script>

</head>
<body>




<fieldset>
<legend> Mon Formulaire </legend>
<form  action="ValidModif.php" method="post">
<label> Nom :    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp <input    type="text" name="Nom" id="nom" value="<?php echo $ligne['Nom']; ?>" placeholder="saisir le    nom"/> </label> <br/>
<label> Prenom : &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp <input    type="text" name="Prenom" id="prenom" value="<?php echo $ligne['Prenom']; ?>"    placeholder="saisir le prenom"/> </label> <br/>

Sexe : &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp   <label> <input type="radio" name="Sexe" id="sexe" value="homme" checked="checked"/> H    </label> 
<label> <input type="radio" name="sexe" id="sexe" value="femme" /> F </label><br/>


<label>Email : &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp <input   type="text" name="Email" id="email" value="<?php echo $ligne['Email']; ?>"   placeholder="saisir le mail"/> </label> <br/>
Pays : &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp      <select name="pays" id="pays" >
<option value="selection"> Selectionnez votre Pays </option>

<option value="tunisie"> Tunisia </option>
<option value="algerie"> Algeria </option>
<option value="maroc"> Morocco </option>
<option value="france"> France </option>
<option value="italie"> Italy </option>
</select><br/>
<label>Telephone : &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text"    name="Telephone" id="telephone" value="<?php echo $ligne['Telephone']; ?>" />  </label><br/>


Besoin d'aide: &nbsp&nbsp&nbsp&nbsp <label> <input type="checkbox" name="Besoin"   id="html" value="html" checked="checked"/> HTML </label>
             <label> <input type="checkbox" name="Besoin" id="css" value="css"    /> CSS </label>
             <label> <input type="checkbox" name="Besoin" id="js" value="js"  /> JS </label>
             <label> <input type="checkbox" name="Besoin" id="php"    value="php" /> PHP </label><br/>

Commentaires : &nbsp&nbsp
<textarea id="commentaires" name="Commentaires" value="<?php echo    $ligne['Commentaires']; ?>" ></textarea>
<br/>
<br/>




&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp <input type="submit"  onclick="validation()" value="Modifier" /> 




</form>
</fieldset>

</body>
</html>
<?php } ?>

ValidModif.php

<?php




$NomR=$_POST['Nom'];
$PrenomR=$_POST['Prenom'];
$SexeR=$_POST['Sexe'];
$EmailR=$_POST['Email'];
$TelephoneR=$_POST['Telephone'];
$BesoinR=$_POST['Besoin'];
$CommentaireR=$_POST['Commentaire'];

include("Connexion.php");
seConnecter();




$requete="update Personne set nom='$nomR' , Prenom='$PrenomR' , Sexe='$SexeR'    ,Email='$EmailR' , Telephone='$TelephoneR' , Besoin='$BesoinR' , Commentaire='$CommentaireR'   where Nom='$NomR' ";
$resultat =mysql_query($requete);

?>

Connexion.php

<?php


function seConnecter(){
$host="localhost";
$user="root";
$pwd="";
$nomdb="CV";

$lien=mysql_connect($host,$user,$pwd);
mysql_select_db($nomdb,$lien);
}


?>

1 个答案:

答案 0 :(得分:1)

之前曾在StackOverflow上提出类似的问题。看这里,这可能会有所帮助: PHP: "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset"