Jump to content

help with php syntax


perficut

Recommended Posts

Im modifying some php lines to fit my need.  I am creating an email to be sent to registered users after they register. I want to change the color of certain text, as well as provide a link but cant figure out how to do so since the font color tag and href tag require quotes.

 

here is a cut

 

$Body .= "Please make note of your login ID and PASSWORD. The login information is case sensitive so be sure to enter it EXACTLY as it appears.";

 

I want it to read as follows.

 

Please make note of your login ID and PASSWORD. The login information is case sensitive so be sure to enter it EXACTLY as it appears.

 

 

Also, I would like to provide a link back to the web page.

 

$Body .="To return to the members page click here";

Link to comment
Share on other sites

if (yourcondion not satisfied )//put you condition here
{
$style = 'style ="color: #FF0000"';
echo 'return to pluto <a href="#">click here</a>';
}
echo 'hi this is <span '.$style.'>teng</span>i havent test this but it should <span '.$style.'>work</span>';

 

is this what you mean!! ;D

 

Link to comment
Share on other sites

two ways to enclose strings in php either with single quotes (') or double quotes (")

or the heredoc syntax, see the php docs for strings

 

if part of your string is the same character you're using to enlclose the strings (either a single quote or a double quote, depending on how you enclose the string)

you will have to ESCAPE that character so php disregards it, but still writes it as you intended it

 

example:

 

$string = "Hello my name is Bob but they call me the \"Mean Machine\", but just call me Bob";

 

I put the escape character \ in front of the character that needs escaping where were two double quotes

 

another example:

$string = 'Hello I\'m super cool, jeah?';

i escape the single quote in an single quoted enclosed string

 

:) have fun, google and the php docs are your friend (http://www.php.net)

You have much to learn, young padooine! I remember when I was asking this same question long long ago, but now I am answering it :) :)

Link to comment
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.