Question: I am creating a checkout system and I am trying to implement tax into it. My business would qualify for Nexus so I am only going to charge tax in the state I am in. Right now the customer enters in the state they live in by typing in the text. So what I am going to do is turn that input field into an option field and list all of the states. The reason for this is so I can carry the value of the tax and ensure the state was entered correctly.

This follow is how I am planning on doing this. Is this a good way to do this or is there a better way I can do it?

I'm not sure how to carry the value with the option chosen though.

```
$base_price = 0;
foreach($_SESSION['shopping_cart'] as $id => $product) {
    $product_id = $product['product_id'];
    $base_price += $products[$product_id]['price'] * $product['quantity'];
    $shipping_price += $products[$product_id]['shippingprice'] * $product['quantity'];
    $tax_price += $base_price * $taxvalue[''];
}

$total_price += $base_price + $shipping_price + $tax_price;

$state['Ohio'] = "Ohio";
$state['Virginia'] = "Virginia";

$taxvalue['Ohio'] = 1.065;
$taxvalue['Virginia'] = 1;

<?php

if(isset($_POST['check'])) {
    $info = isset($state[$_POST['check']]) ? $state[$_POST['check']] : 

    "The requested state doesn't exist";
}
?>

<form action="" method="POST">
    <label>State</label>
        <select class="optionbar" name='check'>
            <option value=''>Select a State</option>
            <?php
                foreach(array_keys($state) as $option) {
                    echo "<option value='$option'>$option</option>/n";
                }
             ?>

```

Answer: 
If you have a list of things like:

* Hello!
* Hello World!
* Hi There!
* World!

And you send `?q=H` to the PHP, it should return only:

* Hello!
* Hello World!
* Hi There!

And for `?q=He`, it should return only:

* Hello!
* Hello World!

From the [documentation](http://loopj.com/jquery-tokeninput/):

> 
> Your script must accept a GET parameter named q which will contain the term to search for. E.g. <http://www.example.com/myscript?q=query>
> 
> 
> Your script should output JSON search results in the following format:
> 
> 
> 
> ```
> [
>     {"id":"856","name":"House"},
>     {"id":"1035","name":"Desperate Housewives"},
>     ...
> ]
> 
> ```
> 
>
Ok, i solve this in this way :

in my HTML file associate "q" to $modify :

```
<input type='text' id='demo-input-facebook-theme' name=modify />
    <script type='text/javascript'> $(document).ready(function() { $('#demo-input-facebook-theme').tokenInput('categorieautocomplete.php?q=$modify', { theme: 'facebook' ,

```

and into my PHP file change query in :

```
$query = ("SELECT ID,CATEGORIA from INTUITcategoria WHERE CATEGORIA LIKE '%{$q}%' ORDER BY categoria");

```

Thank' a lot to all.

Best Regards.

Stefano