$_GET['productid'] gives Undefined even though my url gives the id

Viewed 40

He I'm trying to convert my Javascript var to a php var. I currently use the window.location.href methode but it keeps giving this error

function getId() {
    var url = '#?';
    var query = 'productid=' + productid;
    window.location.href = url + query;
            }
//on buttonclick sends the id to the same page

var_dump($_GET['productid']); //Gives the undefined

$id = $_GET['productid'];
var_dump($id) //Gives undefined aswell

error

enter image description here

link

enter image description here

0 Answers
Related