0
Hello I’m using this code below, to record in $_SESSION, but I’m not getting it. Friends can help me understand why, or even show me where I’m going wrong.
<?php
@session_start(); // Inicia a session.
if(!isset($_SESSION['rede_sociais'])){
// Se a Session não existir eu crio...
$face_status = 'Sim'; // Carrega esse conteúdo
//Armazena os dados na sessão que pode ser bidimensiona(array)
$_SESSION['rede_sociais']['face_status']=$face_status;
}else if(isset($_SESSION['rede_sociais'])){
// Se existir sessão, eu crio aqui
$face_status = $_SESSION['rede_sociais']["face_status"];
}
?>
<?php
//pega o valor do botao
$botao=$_POST['face'];
//verifica se o botao foi clicado
if($botao=="Atualizar"){
$face_status = $_POST["face_status"];
if(!empty($rede_sociais)) {
$_SESSION['rede_sociais']["face_status"] = $face_status ;
echo "<meta http-equiv='refresh' content='0; URL= cabe_rede_sociais.php'>
<script language='javascript'>
window.alert('Dados atualizados com sucesso!');
</script>";
}}
?>
<form method="post">
<label>Habilitar o Link do FaceBook?</label><br><br>
<input type='radio' name='face' value='Sim' checked="checked"/><label>Sim</label>
<input type="radio" name="face" value='Não'><label>Não</label>
<input type="submit" value="Atualizar">
</form>
I thank you all for your attention to my problem, and I await good tips and ideas to solve it.
Hugs to all.
I don’t see in any of your
inputs
one with thename=rede_sociais
. That’s why?– Miguel
Thanks Miguel, for drawing my attention to the input, because the mistakes were in them. I’m posting the code working in answering my own question, thanks? Big hug to everyone.
– Murilo Cabral