Veronica's Query Demo via GET

Note this DEMO passes a variable (and it's value) via a GET ternary operation. In other words, the name of the variable and it's value is being passed through the URL. There is no form involved.
Please note the string "?id=1" in the URL.

This could be used to give users an option to flip through choices. The id in this example refers to a category of furniture for sale.

Category: chairs

ID = 1


DECREASE Number     INCREASE Number      
 

CODE FOLLOWS

<?php
include('includes/header.php');

// set error reporting to all
error_reporting(E_ALL);

// get the id from the URL via GET ternary operator
$id = isset($_GET['id']) ? $_GET['id'] : 0;

// create items array for shopping demonstration
$items = array("beds","chairs","recliners","dining chairs","sofas","end tables",
    
"dining tables","coffee tables","dressers","desks","bookshelves","kids furniture");

?>

<h1>Veronica's Query Demo via GET</h1>

<p>
    Note this DEMO passes a variable (and it's value) via a GET ternary operation.
    In other words, the name of the variable and it's value is being passed
    through the URL. There is no form involved.
    <br>Please note the string "?id=<?php echo($id); ?>" in the URL.
</p>
<p>
    This could be used to give users an option to flip through choices.
    The id in this example refers to a category of furniture for sale.
</p>

<p>Category:
    <?php
    
if ($id > -&& $id count($items))
    {
        echo(
$items[$id]);
    } else
    {
        echo(
'N/A');
    }
    echo(
"<br><br>ID = $id");
    
?>
</p>
<br>
<a href="query_string_via_get.php?id=<?php echo($id 1); ?>"> DECREASE Number </a> &nbsp; &nbsp;
<a href="query_string_via_get.php?id=<?php echo($id 1); ?>"> INCREASE Number </a> &nbsp;  &nbsp; &nbsp;

<?php
include('includes/footer.php');
?>