Jump to content

Recommended Posts

I am trying to use the echo command to put in some html code.

 

I want something like this:

 


echo "<a href="test.php">help</a>";

 

But I am not sure about how to properly insert the html code. I want to use this so I do not have to end the php then start html and then end the html and then start the php ( you get the idea). Any help is appreciated.

Link to comment
https://forums.phpfreaks.com/topic/117755-solved-echo-html/
Share on other sites

<?php
    echo "<a href='test.php'>help</a>";
?>

 

php code needs to be wrapped in php tags and also your use of double quotes twice like that will confuse php so use single quotes inside the double quotes.  Also the file extension (mime type) needs to be page.php or at least something recognized by your server to parse php scripts.  And obviously you need to have the php parser installed.  For longer pieces of html google HEREDOC

Link to comment
https://forums.phpfreaks.com/topic/117755-solved-echo-html/#findComment-605663
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.