Page 1 of 1

Help with auto responder

Posted: Tue Jan 26, 2010 4:08 pm
by blackthumb
Hello all,

I am having some trouble with my auto responder code. Not that knowledgable with php, but do have lots of coding background. Basically, I have an auto responder set up after someone submits their details. My problem is i cannot put any links into the message part of the auto responder.

The code is setup to use variables as the email address, subject and main body. It all works fine with normal text. However, as soon as i put <a href="...">Click here</a> i get a parse error. What am i doing wrong?

$to = "$email";
$subject = "Title";
$body = "message text...";

This is how i have setup my code. I have tried many combinations and everytime it runs, until i enter the html.

All help is appreciated

Re: Help with auto responder

Posted: Tue Jan 26, 2010 4:14 pm
by AbraCadaver
If you have a PHP file then the PHP must be within <?php tags ?>. If you want to add HTML (not PHP) then you have to close the tags:

Code: Select all

<?php
 
$to = "$email";
$subject = "Title";
$body = "message text...";
 
?>
<a href="...">Click here</a>
<?php
 
//more php code
 
?>

Re: Help with auto responder

Posted: Tue Jan 26, 2010 4:34 pm
by blackthumb
Thanks for the quick reply.

Are you saying there is no way for me to put the link in the email text the way I have coded it?

If so, might there be an alternative?

Re: Help with auto responder

Posted: Tue Jan 26, 2010 5:41 pm
by AbraCadaver
blackthumb wrote:Thanks for the quick reply.

Are you saying there is no way for me to put the link in the email text the way I have coded it?

If so, might there be an alternative?
I wasn't paing attention. I thought you were trying to display it in the page. You need to learn how quotes are used in PHP: http://us.php.net/manual/en/language.types.string.php

Re: Help with auto responder

Posted: Wed Jan 27, 2010 3:09 pm
by blackthumb
Thanks for the link pal. I now understand the mail function and all is working fine.

Thanks again!!