Help with auto responder

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
blackthumb
Forum Newbie
Posts: 3
Joined: Tue Jan 26, 2010 4:02 pm

Help with auto responder

Post 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
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Help with auto responder

Post 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
 
?>
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
blackthumb
Forum Newbie
Posts: 3
Joined: Tue Jan 26, 2010 4:02 pm

Re: Help with auto responder

Post 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?
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Help with auto responder

Post 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
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
blackthumb
Forum Newbie
Posts: 3
Joined: Tue Jan 26, 2010 4:02 pm

Re: Help with auto responder

Post by blackthumb »

Thanks for the link pal. I now understand the mail function and all is working fine.

Thanks again!!
Post Reply