从文本框中检索值

I have textbox , i want to retrive the value from the textbox and store it in a php variable . Its not inside a form tag. I am creating a e-commerce website for my class assignment . I retrive each product and display it in the website. I have a quantity text box and a "add to cart button". The value in the cart need to be added to the database

while($row_pro =mysqli_fetch_array($row_mysql) )
{
    $product_id=$row_pro['productID'];
    $product_name =$row_pro['productName'];
    $product_desc= $row_pro['productDesc'];
    $product_price= $row_pro['price'];
    $product_vendor=$row_pro['Vendor'];
    $product_images=$row_pro['image'];
    echo "<a href='detail.php?productID=$product_id'><h3>$product_name</h3></a>
                <a href='detail.php?productID=$product_id'><img src='images/$product_images' width='180px' height='280px'/></a>
                <p>$product_desc</p>
                <p>$product_vendor</p>
                <h4>$product_price</h4>
                <input type='text' name='quantity'>
                <a href='product_display.php?addtocart=$product_id'><button style=\"float:right\">Add to cart</button></a>
        ";
}

You could do something like this:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<input type='text' name='quantity' />
<a id="linkclicker" href='product_display.php?addtocart=1'><button>Add to cart</button></a>
<script type="text/javascript">
$('#linkclicker').click(function() {
    var quant = $('input[name="quantity"]').val();
    $(this).attr('href', $(this).attr('href') + '&param=' + quant);
});
</script>

Change param to the parameter you want. linkclicker you also might want to change to something more descriptive.

You also could validate that quant is an int if that is a requirement. Don't trust that value though in your next script.

I would probably have done this with an HTML form..