Probelms with session variables and if else statements!

Hi

I’m really having issues with session variables in php. I think its down to the following code being wrong. Can anyone tell me if the following code is wrong and if so where?

if($_SESSION['dealership'] == 'site1'){ $Make = 'Bubbles';}
else if($_SESSION['dealership'] == 'site2'){ $Make = 'Toys';}
else if($_SESSION['dealership'] == 'site3'){ $Make = 'Dolls';}

Any help much appreciated, thanks in advance.

sorry worked it out just after I’d posted this!! Daft mistake on my part!!

For me, it looks like a good place to use a switch case:


switch($_SESSION['dealership']) {
	case 'site1': $Make = 'bubbles'; break;
	case 'site2': $Make = 'Toys'; break;
	case 'site3': $Make = 'Dolls'; break;
	// add more cases if needed...
	default: $Make = 'default'; break;
}