-1

My error is :

Notice: Undefined variable: nume in C:\wamp64\www\proiectphp\editarecontp.php on line 44

but i check all my lines and i can't figure out where i'm wrong ... i read all answers from here about this type of error, i try also with empty error, $_post, to put in sql, i tested the connection and everything it's ok at it. I can't undestand where is the problem ...

Code here :

<form action="editarecontp.php" method="POST" >
Nume: <input type="text" name="formnume" value="<?php echo $row["numegraf"];?>"></br>
Prenume: <input type="text" name="formprenume" value="<?php echo $row["prenumegraf"];?>"></br>
Email: <input type="text" name="formemail" value="<?php echo $row["emailgraf"];?>"></br>
Pass: <input type="password" name="formpass" value="<?php echo $row["passgraf"];?>">    </br></br>
<input type="submit" value="Salveaza">
</form>
<?php 
if(!$db) echo mysql_error();
$dbselect=mysqli_select_db($db,'proiectphp');
if(!$dbselect) echo mysql_error();
if (isset($_POST['formnume'])) {
$nume = isset($_POST['formnume']);

.....etc

$sqlmodifica="UPDATE graficieni SET numegraf=$nume , prenumegraf=$prenume , emailgraf=$email , passgraf=$passw WHERE usernamegraf=$userr";
mysqli_query($db,$sqlmodifica);
Qirel
  • 25,449
  • 7
  • 45
  • 62

1 Answers1

2

I think instead of $nume = isset($_POST['formnume']);, it should be $nume = $_POST['formnume'];. isset function returns a a boolean value. You are assigning $nume as a boolean value and than using that in the query.

Another possible reason for this error is that there is no default value defined for $nume and it has been declared in an if block. You may be accessing it in an outer block after if block and in case $_POST['formnume'] is not set, $nume will be never be defined. Hope that helps.

Abhishek Sharma
  • 2,485
  • 1
  • 21
  • 35