ex.
<li value="123">123</li>
<li value="456">456</li>
howto pass value <li value="xxx">
to a php session when clicking on <li value ="xxx">
ex.
<li value="123">123</li>
<li value="456">456</li>
howto pass value <li value="xxx">
to a php session when clicking on <li value ="xxx">
You would create a file that looks like this
// update_session.php
<?php session_start();
if (isset($_POST["val"])){
$_SESSION["val"] = $_POST["val"];
}
Then for your html you would have (note I changed attribute to a data-value because value is not a valid attribute for li whereas the data- prefix attributes are valid.)
<ul id ='my_ul'>
<li data-value="123">123</li>
<li data-value="456">456</li>
</ul>
And you jquery (in a document ready block) would look like this.
$('#my_ul').on("click", "li", function(){
$.ajax("update_session.php",{method:"post", data:{val:$(this).attr("data-value")}});
});