Skip to content Skip to sidebar Skip to footer

How To Add Php Tags Inside Attribute Value?

I'm trying to write meta keywords dynamically with php, so I have such a code , running in WAMP Server localhost/myfile.php :

EDIT: In your wamp config try to disable short open tag

Solution 3:

Try this:

<metaname="keywords"content="<?phpecho implode(",", $my_array);?>">

This way you can print all array content separated with commas. Also make sure your file extension is .php to have your code interpreted.

Solution 4:

Either your file doesn't have a .php extension or you're trying to open it directly from filesystem. For PHP to work you need a server, for example XAMPP for Windows of LAMP package for Linux.

When you have a server running, there will be a directory called htdocs in the server's directory. Put your files in there and type http://localhost/YourFilenameHere in your browser's address bar to access your files.

Post a Comment for "How To Add Php Tags Inside Attribute Value?"