How to Return a Stored Value in Inner text using php -
php code:
$name = 'click here'; echo '<a href="http://example.net/some.php" class="menu">$name</a>';
here expecting 'click here' output is:
$name
the php manual addresses accurately:
note: unlike double-quoted , heredoc syntaxes, variables , escape sequences special characters will not expanded when occur in single quoted strings.
to solve issue, use either 1 of these solutions:
echo "<a href=\"http://example.net/some.php\" class=\"menu\">$name</a>"; echo '<a href="http://example.net/some.php" class="menu">'.$name.'</a>'; <a href="http://example.net/some.php" class="menu"> <?php echo $name; ?> </a>
Comments
Post a Comment