获取输入并将其作为变量传递到同一表单中

I'm sorry for the stupid question but I'm still quite new to php and it's now very very late....

I'm trying to pass an input as part of a form submission inside a php echo (a quantity value as a "data quantity") and I can't quite seem to get it right... can someone please tell me where I'm going wrong... I've tried to get the value but just don't seem to be able to do it... do I need to do some sort of validation first? I'm just really confused at this point...

  $form = '<form><input type="number" name="quantity" min="1" value="1">
    <button type="submit" data-quantity="'.isset($_GET["quantity"].'" data-product_id="'.$_product->id.'"
        class="button alt ajax_add_to_cart add_to_cart_button product_type_simple">add to basket</button></form>';

It's for a custom quantity add in woocommerce - it's because the usual filter isn't compatible with the plugin so I figured this was the next best thing... it works if I manually add a value into data-quantity... thanks for any help in advance !

full file is here: http://pastie.org/10815844#211-215

Set the quantity outside of the form and if it isn't set in the GET array - this defaults to a quantity of 1.

However on looking at the question again - you will need to use the same value in the input - or alternatively on hte onclick of the submit butt on either use javascript to determine the value of the quantity input or simply let the form submit and use the POST or GET array on the next page to get hte quantity value (note that you do not have an action or method for the form either.

if(isset($_GET["quantity"])){$qty=$_GET["quantity"]}else{$qty=1};

$form = '<form><input type="number" name="quantity" min="1" value="' . $qty . '">
    <button type="submit" data-quantity="'. $qty .'" data-product_id="'.$_product->id.'"
        class="button alt ajax_add_to_cart add_to_cart_button product_type_simple">add to basket</button></form>';