0
Save working properly
<?php include "conectar.php";
$nome="$_POST[nome]";
$sobrenome="$_POST[sobrenome]";
$email="$_POST[email]";
$cpf="$_POST[cpf]";
$dddcel="$_POST[dddcel]";
$cel="$_POST[cel]";
$dddtel="$_POST[dddtel]";
$tel="$_POST[tel]";
$nasc="$_POST[nasc]";
$sql->query ("insert into dados(nome, sobrenome, email, cpf, dddcel, cel, dddtel, tel, nasc) values ('$nome', '$sobrenome', '$email', '$cpf', '$dddcel', '$cel', '$dddtel', '$tel', '$nasc')");
header("Location: listar.php");
?>
And this is the one that’s not working:
<?php
include "conectar.php"; //inlui o conectar(endereco do banco)
$nome=$_POST["nome"];
$sobrenome=$_POST["sobrenome"];
$email=$_POST["email"];
$cpf=$_POST["cpf"];
$dddcel=$_POST["dddcel"];
$cel=$_POST["cel"];
$dddtel=$_POST["dddtel"];
$tel=$_POST["tel"];
$nasc=$_POST["nasc"];
$sql->query("UPDATE dados SET nome ='$nome', sobrenome ='$sobrenome', email = '$email', cpf = '$cpf', dddcel = '$dddcel', cel = '$cel', dddtel = '$dddtel', tel = '$tel', nasc = '$nasc' where cod = $cod");
header("Location: listar.php");
?>
Where does the variable come from
$cod
? It contains value?– NilsonUehara
You have the syntax changed:
$nome="$_POST[nome]";
must be$nome=$_POST["nome"];
in all variables.– Sergio
Is there no error message? This would make it easier for us to help you.
– Kayo Bruno