Answer the question
In order to leave comments, you need to log in
How to update session after request?
How to refresh session $_SESSION['site_color']
after request
header('Content-Type: text/html; charset=utf-8');
setlocale(LC_ALL,'ru_RU.65001','rus_RUS.65001','Russian_Russia.65001','russian');
session_start();
//База
include ('../connect/config.php');
if (isset($_POST['update_color'])){
$site_color = stripslashes($site_color);
$site_color = htmlspecialchars($site_color);
$id=$_SESSION['id'];
$site_color = $_POST['site_color'];
$sql = ("UPDATE users SET site_color='$site_color' WHERE id='$id'");
$query = mysql_query($sql);
if (!$query){
die('updating error'. mysql_error());
}
else { echo 1; }
}
session_start();
$_SESSION['site_color'] = $query['site_color'];
header('Location: /settings.php');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question