Answers for "phtml set js var with php value"

PHP
3

using js variable in php

<script type="text/javascript">
var abc= 'this is text';
<?php $abc = "<script>document.write(abc)</script>"?>   
</script>
<?php echo $abc;?>
Posted by: Guest on June-10-2020
2

set php var to html

<?php ob_start();?>
<div>Contents goes <b>here</b></div>
<?php $contents=ob_get_clean();?>
Posted by: Guest on December-17-2020

Browse Popular Code Answers by Language