Hi people,
I am a real newbie so please bear with me.
I have the following php. in the html part at the bottom you will see this line.

Click here to find out: www.data-strategy.co.uk/customers <br>

I need to append the nameID variable to the end of this url and make it clickable.

Any help would be really cool.
Dave

<?php
/ recipients /
$to = "$email"; // note the comma
/ subject /
$subject = "MESSAGE FROM BUGS BUNNY, EDITOR OF PRECISION FIRM";
/ name /
$FirstName = "$FirstName";
$SecondName = "$SecondName";
$NameID = "$NameID";
/ name /
$line = 'Good Morning'. " " .$FirstName . " ".$NameID;

/ message /
$message = "
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<p>$line</p>
<p> blah<br>
more blah</p>
<p> <strong>blah blah<br>
</strong><br>
<strong>blah<br>
</strong><br>
<strong>again more blah</strong> <br>
<br>
But the first question is: How well do you know your customers?
Click here to find out: www.data-strategy.co.uk/customers <br>
<br>
Someone<br>
Editor <br>
Data Strategy </p>
</body>
</html>
";

/ To send HTML mail, you can set the Content-type header. /
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

/ and now mail it /
mail($to, $subject, $message, $headers);
?>

    k i tried this but seems to be an error.

    <br>
    But the first question is: How well do you know your customers?
    Click here to find out: <a href="www.data-strategy.co.uk/customers?nameID=<?=$NameID> www.data-strategy.co.uk/customers "> </a> <br>
    <br>

      Check your code, its not the same as the example i gave you.

      byeee

        sorry about this, I've used the exact code u gave me. See below.
        Still says there is an error with it.

        <br>
        <a href="www.data-strategy.co.uk/customers?nameID=<?=$nameID?>">
        www.data-strategy.co.uk/customers
        </a>
        <br>

          ...What says there's an error with it, and what is the error?

            ok this is the exact code I have inserted.

            <br>
            <a
            href="www.data-strategy.co.uk/customers?nameID=<?=$nameID?>">
            www.data-strategy.co.uk/customers
            </a>
            </br>

            If i run the php file directly through my browser i get a
            Parse error on line 30.

            Line 30 being the href line.

            Cheers

              Hi,

              since this is part of a string already use just

              $nameid

              instead of

              <?=$nameID?>

              and use \" instead of " in

              href="..."

              I'd suggest to use HEREDOC style in this case:

              $message = <<< EOHTML
              ....
              <a href="www.data-strategy.co.uk/customers?nameID=$nameID"> 
              www.data-strategy.co.uk/customers
              </a> 
              ....
              EOHTML;
              

              You don't need to escape " in this case. But make sure that the $message=... line ends with EOHTML without any spaces after EOHTML.

              Thomas

                oooh, since your html is being put inside a php variable you have to escape the quotes, like so:

                <br>
                <a
                href=\"www.data-strategy.co.uk/customers?nameID=$nameID\">
                www.data-strategy.co.uk/customers
                </a>
                </br>

                  Wicked thanks everyone.
                  I'm a flash designer, so all this php lark is a bit alien to me
                  but I got it working thanks to you guys.

                  Thanks again.

                    Write a Reply...