i need help in php
<?php
$num=2;
?>
<a href="action.php?id='.$num.'">Text to be displayed</a>
Here i m not getting $num value when i print echo $_GET;
Use code tags.
Shouldn't
<a href="action.php?id='.$num.'">Text to be displayed</a>
be
<a href="action.php?id=<?php echo $num; ?>">Text to be displayed</a>
?
I ask because you appear to be concatenating $num outside of a PHP block.
Always enclose PHP stuff into a PHP block. The code should be: <a href="action.php?id=<?php echo $num; ?>">Text to be displayed</a>
or in this case printing a variable content: <a href="action.php?id=<?=$num?>">Text to be displayed</a>
Ops. Scru and me the same response. You can use the last example too.
Great! its working. Thank you for ur help
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.