Skip to content
Advertisement

Add PHP variable inside echo statement as href link address?

I’m trying to use a PHP variable to add a href value for a link in an echo statement.

Here’s a simplified version of the code I want to use. I know that I can’t just add the variable into the echo statement, but I can’t seem to find an example anywhere that works.

JavaScript

Advertisement

Answer

Try like

HTML in PHP :

JavaScript

Or even you can try like

JavaScript

Or you can use PHP in HTML like

PHP in HTML :

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement