I want to use a php variable into HTML tag id .

For e.g. <?php
$temp='123';
?>

Now i want to use $temp as a ID in DIV

say <div id="$temp"></div>

How i'm able to do this .

<?php
$temp='123';
?>
<div id="<?php print $temp; ?>"></div>

OR

<?php
$temp='123';
print '<div id="'.$temp.'"></div>';

Either of those will do the trick. You can also use echo instead of print.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.