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

i've got this error on modifier.php and i don't how to resolve the problem and the same on 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

Here's my code I have also add and delete and they work fine so there is no problem with the database i think i'm missing something here thank you for advance

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 Answers1

1

A similar question was asked on StackOverflow once before. Look here, this may help: PHP: "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset"

Community
  • 1
  • 1
gtr1971
  • 2,672
  • 2
  • 18
  • 23