PHP how to make URL something like product.php?id=1

Since the id parameter is in the url it is called a GET parameter. You can access to GET parameters using the global variable $_GET.

In product.php you should have something like:

if(isset($_GET['id'])){
    $id = $_GET['id'];
    if($id=='a'){
        // do something
    }
    else if($id=='b'){
        // do something else
    }   
}

Leave a Comment