Zend certified PHP/Magento developer

Take input result value and add that to the cart

I need to get the result value of this calculator to add to the cart from the product page for both single and configurable products.

enter image description here
I add the calculator to catalog_product_view.xml



Then I copied the code from addtocart.phtml to calc.phtml as the button and changed the QTY to my result value (var metres)

< ?php if ($block->shouldRenderQuantity()) :?>
< ?php endif; ?>
< ?= $block->getChildHtml('', true) ?>

The block didn’t even appear once I put the above code in. Any help would be appreciated