I'm looking how I can get <p id="test"></p>
as number in PHP.
I have select option and with code below I get my variation id selected as html paragraph <p id="test"></p>
but I need it as number in PHP to run another PHP code to compere something how can I convert <p id="test"></p>
to a number in php without using another java script I just need number form my code below as variable number in php.
I'm using woocommerce plugin in WordPress and I need new way of showing images based on user selected option in single product page instead of switching I need to overlay product image with variation images because of that I have user selected option with code below but I need it to work in php I don't know how to convert <p id="test"></p>
this code to php to get number and do my other things I know how to do I just need to get <p id="test"></p>
as number in php .
<?php
if ( $product->is_type('variable') ) {
?>
<script>
jQuery(document).ready(function($) {
$('input.variation_id').change( function(){
if( '' != $('input.variation_id').val() ) {
var var_id = $('input.variation_id').val();
document.getElementById('test').textContent = var_id;
}
});
});
</script>
<?php
}
?>
I need to get instead of this <p id="test"></p>
a number in php .