GoodDay! Is there a solution to assign a Javascript value to PHP Session.?
var radioVal = $(this,".margin_left25").val();
$_SESSION['value'] = radioVal;
You can't mix PHP and JS. You, however, can send a POST request via AJAX to the server to set this variable.
Take a look at jQuery.post()
Modified example from linked page:
$.post("test.php", { radioVal: $(this,".margin_left25").val() }, function(data) {
alert("Data Loaded: " + data);
});
Then in test.php you can do
session_start();
$_SESSION['value'] = $_POST['radioVal'];
Alternate Method (no AJAX)
Make a new image and set the source as your URL with your parameter.
Example:
var img = new Image();
img.src = "test.php?radioVal=" + encodeURIComponent($(this,".margin_left25").val());
There is no image, obviously, but it'll try to load the URL and your PHP will still execute.
You'll have to send a request to the server, and have PHP process that request. For instance, you could use an Ajax request (in jQuery):
$.post("setsession.php", {"value" : $(this,".margin_left25").val(); });
And in setsession.php:
<?php
session_start();
$_SESSION['value'] = $_POST['value'];
Other ways to do this would be to submit the form, etc., but you must generate a request, via Ajax or otherwise, to have any interaction whatsoever between client (JavaScript) and server (PHP).