Re: Cannot send a hyperlink

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Brad,
please, try solving these kinds of things yourself. Especially seen as the parse error which you posted here was already found and shown to you in one of your earlier posts to this list (if I'm not mistaken).

So, your problem is:
 $body.= '<a href="'http://www.zoneofsuccessclub.com'">link </a>';

Try to spot the problem here. I'll give you a hint: it has to do with single-quotes.

Right, I hope you've guessed it by now, but in case you haven't, let's dissect the problem:
'<a href="' = T_STRING
http://www.zoneofsuccessclub.com = unknown [1]?
'">link </a>' = T_STRING

So, we basically have 2 strings, with a bit of weirdness sandwiched in between them. To the parser: this might be several constants joined together using the . (concatenation operator). But: it can't be, because it has a : and a / in it. So... no, the parser has not a clue what this might be, so it spits out an error. So, how do you solve your problem; well, first of all, YOU know it's supposed to be a string, so let's make it one:
 $body.= '<a href="'.'http://www.zoneofsuccessclub.com'.'">link </a>';
That would work, but it's needlessly complicated, we don't need to glue 3 strings together if we can do it all in 1 string aswell. So let's change it to:
 $body.= '<a href="http://www.zoneofsuccessclub.com";>link </a>';
whoa! it works!

Next time Brad, please try to take a look yourself at the line the error indicates (and the lines around it aswell) and TRY to figure out what MIGHT be wrong.

- Tul

P.S. to admin@xxxxxxxxxxxxxxxxxxx, if you try saying "These are the same people who again and again are not the ones who answer the questions, yet try to take credit by belittling the answer with gibberish." about me once more, I will get very pissed. I spend a lot of time trying to get people to code efficiently and in a readable way. If I post to the list trying to bring clarity into your code, then there is a very good reason for it. I don't belittle your answer, and I don't appreciate such bullcrap.

Brad wrote:
We are sending email now,
But we are back to the original problem,
No hyperlink!

  $email = $_REQUEST['email'] ;
  $fromaddress .= 'admin@xxxxxxxxxxxxxxxxxxxxx';
  $fromname .= 'Zone of success Club';
  $eol="\r\n";
  $headers .= "From: ".$fromname."<".$fromaddress.">".$eol;
  $headers .= "Reply-To: ".$fromname."<".$fromaddress.">".$eol;
$headers .= "Return-Path: ".$fromname."<".$fromaddress.">".$eol; $headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol; $headers .= "X-Mailer: PHP v".phpversion().$eol; $msg .= "--".$htmlalt_mime_boundary.$eol;
  $msg .= "Content-Type: text/html; charset=iso-8859-1".$eol;
  $msg .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
  $body.= '<a href="'http://www.zoneofsuccessclub.com'">link </a>';
  $msg .= $body.$eol.$eol;
  mail($email, $subject, $msg, $headers);


Yields

Parse error: parse error, unexpected T_STRING in
/home/zoneof5/public_html/index.php on line 76

-----Original Message-----
From: Daniel Brown [mailto:parasane@xxxxxxxxx] Sent: Wednesday, November 14, 2007 11:09 AM
To: Brad
Cc: admin@xxxxxxxxxxxxxxxxxxx; php-general@xxxxxxxxxxxxx
Subject: Re:  Cannot send a hyperlink

    Brad,

    That code is a mess and highly incorrect, even at a novice level.
Let me give you a hand....

On Nov 14, 2007 10:31 AM, Brad <brads@xxxxxxxxx> wrote:
I implemented the proposed code, and emails are not being sent?

Any suggestions?

Here is the code

<?

  $email = $_REQUEST['email'] ;
  $eol="\r\n";
  $headers .= "From: ".$fromname."<".$fromaddress.">".$eol;
  $headers .= "Reply-To: ".$fromname."<".$fromaddress.">".$eol;
  $headers .= "Return-Path: ".$fromname."<".$fromaddress.">".$eol;
  $headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol;
  $headers .= "X-Mailer: PHP ".phpversion().$eol;
  $msg .= "--".$htmlalt_mime_boundary.$eol;
  $msg .= "Content-Type: text/html; charset=iso-8859-1".$eol;
  $msg .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
  $body.='<ahref="'.www.zoneofsuccessclub.com.'">link </a>';
  $msg .= $body.$eol.$eol;
  mail($to, $subject, $msg, $headers);

?>

[snip]

    1.) You reference $to in the mail() function, but there is no $to
defined.  Instead, either change $email to $to or vice-versa.
    2.) You don't need to start the first line of a variable off with
a .= --- this will append to an existing variable of the same name, if
it exists.
    3.) You change your quoting style where it's not necessary.  All
$msg lines should be using double quotes in your code above.
    4.) <ahref="..." is not a tag.  The correct usage is <a href="..."
    5.) You have things in the message body that should be in the headers.
    6.) You don't need to do a carriage return and newline in the
message body.  A simple \n will suffice.
    7.) I'm not sure what you hoped to achieve with the
"'.www.domain.com.'" conglomerate, but.... don't.  That makes PHP
think that the domain is some sort of internally-defined variable of
horrible construct.
    8.) You should use http:// prior to the FQDN.

    Taking hints from what appears to be your code, this is how it should
be:
<?
$email = $_REQUEST['email'] ;
$eol="\r\n";
$headers  = "From: ".$fromname."<".$fromaddress.">".$eol;
$headers .= "Reply-To: ".$fromname."<".$fromaddress.">".$eol;
$headers .= "Return-Path: ".$fromname."<".$fromaddress.">".$eol;
$headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol;
$headers .= "X-Mailer: PHP ".phpversion().$eol;
$headers .= "--".$htmlalt_mime_boundary.$eol;
$headers .= "Content-Type: text/html; charset=iso-8859-1".$eol;
$headers .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
$body = "<a href=\"http://www.zoneofsuccessclub.com\";>link </a>\n";
mail($email, $subject, $body, $headers);
?>

    Prior to asking a bunch of questions on the list, which seriously
puts you at risk for being flamed or ignored, check out these
references:
    http://www.bath.ac.uk/bucs/email/anatomy.shtml  [Anatomy of an
Email Message]
    http://www.php.net/mail  [PHP Mail Functions]
    http://www.htmlgoodies.com/primers/html/  [Beginner's Guide to HTML]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux