I am trying to pass several variables per cookie from javascript to php, but I get that they are undefined. If I try to pass only one variable, if it works, I guess I'll have to treat it as an array, but I do not know how to handle it.
JavaScript
function modificarFormacion()
{
var tipo = document.getElementById("tipo");
var categoria = document.getElementById("categoria");
document.cookie = "tipo="+tipo.value;
document.cookie = "categoria="+categoria.value;
}
PHP
<?php
$tipo = $_COOKIE['valor'];
$categoria = $_COOKIE['categoria'];
echo $tipo;
echo $categoria;
?>
If I do it only with type or with category, if I show in PHP the value of the variable.
How can I solve the problem of passing variable variables from JavaScript to PHP?