1
ola personal I am developing a job and I need to get a value by get in the url but I’m not getting if someone can help me and show my mistake I thank you:
<?php require_once("../database/conexao.php") ?>
<?php
url = teste.com/teste.php?q=123456
if( isset($_POST) & !empty($_POST) ) {
$cpf = $_GET["q"];
$npass = $_POST["newpass1"];
$newpass = "UPDATE usuarios ";
$newpass .= "SET ";
$newpass .= "senha = '{$npass}' ";
$newpass .= "WHERE cpf = '$cpf'";
$confirma = mysqli_query($conecta,$newpass);
if($confirma){
echo $cpf;
echo "senha alterada com sucesso";
}else{
echo "problemas ao alterar senha";
}
}
?>
I put an echo in my variable $cpf
and she doesn’t show up at all
But the message appears
"senha alterada com sucesso"
?– Sam
Your script will only run if you have any $_post. So if nothing is not running. Another thing is that the $confirms variable is checked if it is true. Maybe your request in the bank is not executed because it is giving error. In this part Where Cpf = pra$Cpf' if Cpf is an integer number of 11 digits without the dots will pass, if it is not have to put inside brackets. Another thing is that if you don’t have Cpf in the bank you want to change you can return false.
– Willian Coqueiro
Hello friend thanks for the reply, is this is only the part of the code it is interacting with an html and when I give the post through a botao Submit appears the password message successfully changed but in the bank continues to precede and as I said when I ask him to show me the get with an echo does not appear value none. this is to be m password reset method by link
– iuryol