This code should take the id of the div when I clicked on button inside this div. Then it should echo this id, I have many divs each with different id.
The program works correctly when I press on first div (it reloads the page and pass the id variable as global variable and then echo it), but the code does not work correctly when I press on another div (it did not pass the id variable as session variable).
javascript code:
var javascriptVariable = this.id;
document.getElementById('adcode').value = this.id;
alert(javascriptVariable );
php code:
echo "<form action='personalpage13.php'>";
echo"<input type='submit' style='display:none;' class='b1' value='b1' id=".$x.">";
echo"<br />";
echo"<input type='hidden' name='adcode' id='adcode'/>";
echo" <br />";
$_SESSION["bb"] =$_GET['adcode'];
$d =$_SESSION["bb"] ;
echo"</form>";
and this to get the id var on reload of the same page:
$e=$_SESSION["bb"];
echo $e;