Is this possible?
if ($_SESSION['variable'] = 'one' {
$_SESSION['variable'] = 'car';
}
It doesn't seem to be working. Is this enough information?
Is this possible?
if ($_SESSION['variable'] = 'one' {
$_SESSION['variable'] = 'car';
}
It doesn't seem to be working. Is this enough information?
Yes you can overwrite variables, but your codes syntax is wrong, try:
if ($_SESSION['variable'] == 'one') {
$_SESSION['variable'] = 'car';
}
there is a syntax error and also in if
clause your are not checking you are assigning the value
session_start();
if ($_SESSION['variable'] == 'one') {
$_SESSION['variable'] = 'car';
}
The reason it isn't working is due to your syntax errors.
Here's an example that might help you understand what's going on...
$_SESSION['variable'] = 'one';
// use == for comparison... = for variable assignment
if($_SESSION['variable'] == 'one'){
// reassign
$_SESSION['variable'] = 'car';
}
var_dump($_SESSION);
// array(1) { ["variable"]=> string(3) "car" }
There is a syntax error or probably a typo in your code Try this
if ($_SESSION['variable'] == 'one') {
$_SESSION['variable'] = 'car';
}