without seeing the rest of your code, here are some suggestions to clean that up:
PHP Code:
<?php
session_start();
// [ ...code... ]
switch($whatever){
case 'hat:':
if(isset($_SESSION['hat:'])){
$_SESSION['hat:'] = $_SESSION['hat:'] + 1;
}else{
$_SESSION['hat:'] = 1;
}
break;
}
echo "Used lives = ".$_SESSION['hat:'];
?>
important parts:
1)always use full syntax, and don't leave out the { brackets }, etc. If there's trouble, that's the first place to look.
2)you were missing the switch statement for your hat: case. (I used $whatever as the variable, but use whatever you intended to use.)
3)functions like session_start() need to be called first, way up at the top.
incidentally, your if...else above could be rewritten in several quicker ways. this would be my personal preference:
PHP Code:
$_SESSION['hat:'] = isset($_SESSION['hat:']) ? $_SESSION['hat:']++ : 1;
Bookmarks