-5
I need to change the values of SESSION’s name, login and password, but I’m not getting.
I think the problem is in this part of the code,
if(!isset($_SESSION['usuario'])){ // Se a Session não for iniciada
$nome = 'Nome do Usuário'; // Carrega esse conteúdo
$login = 'usuario'; // Carrega esse conteúdo
$senha = '123'; // Carrega esse conteúdo
}else{
if(isset($_SESSION)){ // Se a Session for iniciada
because when I remove it, I can at least record the changes in SESSION’s using WAMPSERVER.
Below put the code I’m using along with the address http://buziosnegocios.com.br/ of access so that friends can verify what is happening, ie what is not happening ;).
Code:
<?php
@session_start(); // Inicia a session.
if(!isset($_SESSION['usuario'])){ // Se a Session não for iniciada
$nome = 'Nome do Usuário'; // Carrega esse conteúdo
$login = 'usuario'; // Carrega esse conteúdo
$senha = '123'; // Carrega esse conteúdo
}else{
if(isset($_SESSION)){ // Se a Session for iniciada
$nome = $_SESSION["nome"];
if($nome) {
$login = $_SESSION["login"];
if($login) {
$senha = $_SESSION["senha"];
if($senha) {
}}}}}
?>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<label>Nome do Usuário: </label><span><?php echo $nome ?></span><br /><br />
<label>Login do Usuário: </label><span><?php echo $login ?></span><br /><br />
<label>Senha do Usuário: </label><span><?php echo $senha ?></span><br /><br />
<form method="post">
<label>Nome do Usuário:</label><br />
<input type="text" name="nome" value="<?php echo $nome ?>"><br /><br />
<label>Login do Usuário:</label><br />
<input type="text" name="login" value="<?php echo $login ?>"><br /><br />
<label>Senha do Usuário:</label><br />
<input type="text" name="senha" value="<?php echo $senha ?>"><br /><br />
<input type="submit" value="Atualizar" />
</form>
<?php
$nome = $_POST["nome"];
if($nome) {
$_SESSION["nome"] = $nome ;
$login = $_POST["login"];
if($login) {
$_SESSION["login"] = $login ;
$senha = $_POST["senha"];
if($senha) {
$_SESSION["senha"] = $senha ;
header('Location:index.php');
}}}
?>
I await good tips, and thank you all for your attention. Hugs.
Hello Localhost, it worked smooth smooth, thank you very much for your guidance. But I ask you a question, I can use that same reasoning for when I use a textarea. And how can I improve these Ifs, give me a hint there because as you have already seen, I am very lay in PHP, ;). I am learning PHP using tutorials taken on Youtube, and I try to apply to learn a little bit with each tutorial. Send your idea to improve Ifs, thanks? Great hug, and once again QUARREL...
– Murilo Cabral
I edited the Ifs at the end there, take a look...
– LocalHost
Hello Localhost, I’m trying to use the same logic to use with radio buttons, but I’m not getting it. Is there any way you can give me this one, but show me where I’m going wrong, or will it read differently when it comes to radio buttons? The Code I am using is Below:
– Murilo Cabral
I’ll be posting the code answering my own question, thanks?
– Murilo Cabral