Help, trying to process html select variable to session variable via jquery and php

Currently when I change the select option it correct dials up the js code at the top of the form, but then I’m not sure if it’s actually calling the php script, falling over somewhere in the process, the zombie apocalypse has started as I’m not getting anything back … I think … dazed and confused folks.

What I want to do is change the Session variable theme on change of the html select :frowning:

	if(!isset($_SESSION['theme'])) {
		$style_dir = "./standard";
	} else {
		$style_dir = $_SESSION['theme'];
		die("theme ".$style_dir);

<!DOCTYPE html>
		<title>Test page</title>
		<script src="./js/jquery.js"></script>
			function themeChange(){
				var myselect = document.getElementById("theme");
				var theme = myselect.options[myselect.selectedIndex].value;
				var datastr = "style=" + theme;
				//Call php to change the server side session variable
					type: "POST",
					url: "theme.php",
						var variable = '<%= Session["theme"] %>';
						alert("Style : " + variable);
		<h1>Current Theme&nbsp;|&nbsp;<?php echo($style_dir); ?></h1>
		<h3>Select theme</h3>&nbsp;&nbsp;
		<select id="theme" onchange="themeChange()">
			<option value="standard">Standard</option>
			<option value="orange">Orange</option>
			<option value="purple">Purple</option>

and the simply php stuff


	$theme = $_POST["style"];
	$_SESSION['theme'] = "./".$theme;

Echo out the style when you update the session, and then the success method will be able to receive that echo as a response, for your confirmation.


$_SESSION['theme'] = "./".$theme;
echo $theme;

success: function (response) {
    alert("Style : " + response);