"how to display a php variable into html" Answer’s

0

Make your code more concise with jQuery:

(1) Add this in your <head>:

<script src="http://code.jquery.com/jquery-latest.min.js"></script>

(2) Create an element where you want the variable to be displayed, and give it an ID, e.g.:

<span id="printHere"></span>

(3) Add this in your JavaScript:

var duration="<?php echo $postduration ?>";
$('#printHere').html(duration);

For your PHP, try the following two options:

<?=$postduration?>

or...

<?php echo $postduration; ?>
Wednesday, March 31, 2021
 
Rudie
answered 11 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :